Head in the clouds.. Blending depth test

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 11, 2004 at 23:45

Hi, I just want to know something before I waste my time on a perhaps pointless implimentation:

I currently have a nice little scene, with alpha blended clouds in the sky and some landscape ect.. you know the drill. Anyway, I draw the clouds (with depth-test off due to blending), then the ground. Because of this, when you view the ground from above the clouds (billboarded) the clouds are behind the ground -> not good :)

To fix this, must I have the engine do its own depth testing to draw the sprites and normal objects in the correct order? Or should I draw the sprites in the correct z depth order with depth-testing on?

Or am I missing another way to solve this?
(Life was nicer when things were more simple :D)

Ed

9 Replies

Please log in or register to post a reply.

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 12, 2004 at 00:19

first of all… depending on the kind of scene you have this is not a problem at all. ask yourself if in your game or whatever you are doing somebody will ever see the ground from the air through the clouds. if that’s really happening…. how many clouds are there ? can you sort them in reasonable time ?
*yawn* i’ll try to dream of some elegant way :) i’m too tired to think right now

E05263ec846eb85da803f56e2917962d
0
Noor 101 Jul 12, 2004 at 03:05

<OFF TOPIC>
Welcome back Ed Mack! long time no see :)

357c7b2935ccd2cb0913717186684394
0
JSoftware 101 Jul 12, 2004 at 16:58

couldn’t you just see when your height is over the height of the cloud then you draw the cloud before the ground? :P

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 12, 2004 at 17:01

Well, sometimes you will see from above the clouds. However, the same cloud drawing class is used for drawing other specialFX, so it matters then. If I impliment octrees soon, that’ll allow me to sort quickly. That’s once I get my recently crippled model loading working :)

Hi nkharrat, I missed this place - I have been lurking from time to time. Now summers upon me, I’ve been furiously hacking at my little C++ engine project, growing from 639 lines to 2571 in the last few weeks (which is good for me). If only the tri-effect competition had been on now!

Nice to see you all, anubis too :) I’m now waiting for dave permen to bring along a wonder solution. Love the fast reply function btw.

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 12, 2004 at 17:48

Love the fast reply function btw.

yeah, what a great invention :)

Well, sometimes you will see from above the clouds

what is it exactly you are coding ?

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 12, 2004 at 21:59

what is it exactly you are coding ?

Well, right now not much. It’s at this point a generic engine, really a testbed for things I want to code up (that is further features for it). The aim is to add features in a non dirty-hacklike manner. It’s mainly set outside… here

Screenshot! :D

castle\_screenshot.jpg

I’m about to model better tents in 3dMax (I have just added support for multiple textures per model :))

Anyway, the ‘clouds’ are also the flames, the misty effect, the plauge of locusts ect.. This gives a problem :) I’ll soon conjure some sort of particle engine *yawn*.

BTW, just to add to my happy long post, I’ve got a GeForce 6800 in the mail from Dabs, for the first time I’ll not have a crappy gfx card. So, I can soon go vertex and fragment shader mad! I’m soo excited. I had to buy a newer motherboard just to have AGP 8x (don’t even say PCX).. it was cheap, and has lots of slots! (Smiles, beamingly)

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 13, 2004 at 19:29

Ok, My use of blending is to get transparent parts on my quads/triangles. When you specify a texture as GL_RGBA, does that cause anything to happen then?

I got my tents sorted :D

castle2\_screenshot.jpg

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 13, 2004 at 19:36

When you specify a texture as GL_RGBA

the “alpha” in alpha blending means something different. it’s just the blending parameter, which is why you can specify the pixels alpha value, color or something else (0, 1)

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 13, 2004 at 22:58

Ah, good - thanks for that :)