Fake Plant

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.

I am trying to recreate this:
Beautiful shadowed fern plant

The model is free, so you can download it too. :wink:
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! :slight_smile: ).

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).

Thanks everyone in advance! :slight_smile:
Cheers,
Rod

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.

hth

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.

hth

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?) :confused:

Thanks!

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 :slight_smile: .

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?

Thanks!

Check out Nvidia’s SDK samples, for example (very tasty) :slight_smile:

http://download.developer.nvidia.com/developer/SDK/Individual_Samples/samples.html

Oh, and I rather think the projection of alpha tested/blended textures to create a shadow mask of sorts would work quite nicely (FWIW).

… eye dropping examples!.. :eek:
Thanks for the link!

I found two really good tutorials by now. Do you recommend NVidea’s “Hardware approach” (no shaders as I understood), or using shaders?

Do shaders solutions always have best performance?

Oh… and ever anyone heard about a technique called “Forward shadow mapping- new approach to real-time shadow generation”? Is this a better aproach?

Thanks so much everyone!!! :slight_smile:

I recommend using the hardware wisely :wink:

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.

Hope this helps.

Originally posted by spectranaut:
I recommend using the hardware wisely :wink:

…Just to make sure. You mean you recommend I use shaders right?

(NVidea refers to ‘Hardware’ in their page as using extensions)

Thanks so much everyone! :slight_smile:

Rodrix, that is correct. I recommend using shaders, hardware permitting.

Sorry if that wasn’t clear before.

Thanks everyone!
Really thanks! :slight_smile: