Hi everyone!
I am trying to render a fake plant that consists of bunches of square leafs mapped with an alpha texture of a real fern. Therefore, even though the plants leafs are squared polygons, the leafs have real leaf shape as alpha channel is used. The final render consists of about just 18 polys so it’s very cheap.
The model is free, so you can download it too.
Yes! It’s awesome… However the problem is that once loaded into OpenGL, it looks terribly fake without shadows.
3D studio Max creates a shadow based on the texture, not just based on polygons.
I there a way I can recreate that in OpenGL using real time graphics?
I am developing a game engine, so I don’t mind how difficult the solutions are (Although I prefer them easy! ).
I have still to decide what shading method to implement in my game engine, so I would like to know what the options are. My first concerns is performance.
Right now I am using alpha textures contained in rectangles below objects to represent their shadow. I use a different texture for each object. This works great except for the fact that I must always drawn the sun ontop of my skybox (so that shadows keep correct direction), and that things get sometimes screwed up because of the blending ( I may have to use multitexturing I guess).
you can project the geometry onto the ground plane and construct a mesh for shadow modulation or you could use realtime shadowing techniques to generate the shadows in realtime. there are many popular techniques available online if you search. there are also many books that cover the more popular ones like the shaderx books and gpu gems to name a few.
sorry, i meant texture not mesh. you can project the geometry into a texture for projective modulation which is usually just a darkening of the ground plane.
Originally posted by <zenith>:
[b]you can project the geometry into a texture for projective modulation which is usually just a darkening of the ground plane.
hth [/b]
…But the geometry projection doesn’t take into account the alpha values of the textures of the objects, right? Therefore I will get a the shadow of a plant with square leafs instead of the actual leafs described by the texture, right?
(So it won’t produce the results shown in the link with such a low polygon count?)
For billboarded textures it is simpler to go the shadowmap route. Using alphatest during shadow depthamp will retain your fine leaves.
Volume shadowing (ie. with stencil) won’t work unless a lot of work (creating a high poly version).
I don’t know if it is still the case, but with old 3dsmax versions, you could see that with raytraced shadows, it ignored texture alpha. It only worked with shadow mapping.
Thanks! I read about Shadow Mapping on wikipedia. It sounds like a good idea .
Do you any good Shadow Mapping tutorial to recommend me? I read that it can be implemented either through GL_ARB_shadow extension (but that it required multiple passes) or through shaders. Which one do you recommend?
Shaders are a good bet these days, and they’re here to stay. If you’ve got the hardware to use them, then I suggest you do so.
If you are targeting earlier hardware that has no support for them, then of course you have little choice but to use the fixed function stuff. But even so, there are still quite a few possibilities without shaders, as demonstrated by the myriad demos at Nvidia and elsewhere.