Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Fake Plant

  1. #1
    Senior Member Regular Contributor
    Join Date
    Dec 2005
    Posts
    256

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

    Thanks everyone in advance!
    Cheers,
    Rod

  2. #2
    Guest

    Re: Fake Plant

    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

  3. #3
    Guest

    Re: Fake Plant

    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

  4. #4
    Senior Member Regular Contributor
    Join Date
    Dec 2005
    Posts
    256

    Re: Fake Plant

    Originally posted by <zenith>:
    you can project the geometry into a texture for projective modulation which is usually just a darkening of the ground plane.

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

    Thanks!

  5. #5
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Fake Plant

    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.

  6. #6
    Senior Member Regular Contributor
    Join Date
    Dec 2005
    Posts
    256

    Re: Fake Plant

    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?

    Thanks!

  7. #7
    Senior Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    739

    Re: Fake Plant

    Check out Nvidia's SDK samples, for example (very tasty)

    http://download.developer.nvidia.com...s/samples.html

  8. #8
    Senior Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    739

    Re: Fake Plant

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

  9. #9
    Senior Member Regular Contributor
    Join Date
    Dec 2005
    Posts
    256

    Re: Fake Plant

    ... eye dropping examples!...
    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!!!

  10. #10
    Senior Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    739

    Re: Fake Plant

    I recommend using the hardware wisely

    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.

Page 1 of 2 12 LastLast

Similar Threads

  1. Fake shadow
    By Teo in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 02-23-2006, 12:05 PM
  2. Drawing a plant stem
    By legendkiller in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-02-2004, 05:36 AM
  3. fake bump mapping?
    By JacekPoplawski in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 08-10-2002, 01:02 AM
  4. Best to fake it?
    By dabeav in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-28-2002, 03:00 PM
  5. fake shadow
    By jeppa in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-18-2001, 10:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean