Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

skow

Reflective water using shaders

This topic is 5187 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to create some lakes to go with some randomly generated terrain I’ve made. Preferably I would like to have a nice wind ripple across the lakes. Due to the nature of this terrain being random I can’t just create quads where ever a lake should be, instead I’m having a simple: If (vertex.y < lakeHeight) vertex.y = lakeHeight; To create a flat lake surface, the problem I can see coming from this is the texture coordinates for each quad won’t allow me to apply a reflective texture. This prevents my idea of drawing all the geometry flipped with a clipping plane at the height of the lake, then rendering to texture and applying to the lake from working. I''m fairly new to using cg, so I''m also not sure how to use a fragment shader to do a ripple. I’ve seen some people here doing this (like the rhino island demo). Any one have some suggestions or a good site that may help me?

Share this post


Link to post
Share on other sites
Advertisement
i think you should look into using EMBM (Environment Mapped Bump Mapping).

Why are you changing the terrain, just make a big plain that resides at the lake height and do the reflective textureing on
that rather than modifying your terrain data.

Share this post


Link to post
Share on other sites
The terrain I''m using is VERY large, 8.4 million triangles quadtree/frustrum culled. It takes literally 5 minutes to fly across.

That is too big to make a reflective texture for.

Share this post


Link to post
Share on other sites
bump for mabey some comments from people who used reflective water in there contest entries.

Share this post


Link to post
Share on other sites
i could have a terrain with 2 triangles and make it take 5 mins to fly across.....
1) i could make the triangles really big
2) i could make the camera very low on the terrain (ie the triangle) and move the camera very slowly

i could have a terrain with 10 billion triangles and fly across it in 5 seconds.....

so the number of triangles in your terrain and how long it takes to "fly" across it is really vague

quote:

Why are you changing the terrain, just make a big plain that resides at the lake height and do the reflective textureing on
that rather than modifying your terrain data.


but i agree with that unless you want dynamic lighting...then you run into a problem with one big plain
but for that one big plaqin you could use a light map if you dont need dynamic lighting for it


"A soldier is a part of the 1% of the population that keeps the other 99% free" - Lt. Colonel Todd, 1/38th Infantry, Ft. Benning, GA

[edited by - ncsu121978 on March 8, 2004 12:20:05 PM]

Share this post


Link to post
Share on other sites
For the above post...

It would be 5 mins of "full stride running" on this.
http://www.mines.edu/students/m/mskowron/T1.jpg

The amount of triangles and the time it takes to cross should give you some clue...

The point is it is much to large to make one quad and texture.

I''m looking for some concept help (how am I going to do this) if any one could provide some pointers.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

Share this post


Link to post
Share on other sites
the quad doesn''t need to cover the entire block of terrain, it can simply go as far as the fog cutoff. And it can be more than one, ie, a grid.

For the texture, the texture will need to be projected onto this plane so the size doesn''t matter. It would be just like how you are rendering now, but from the mirrored position on the water plane.

| - My project website - | - email me - |

Share this post


Link to post
Share on other sites
Ok that is do-able.

Will I have to render the terrian upside down to texture unprojected first?

If so how do I unproject the rendering?

Thanks!

Share this post


Link to post
Share on other sites
given the position of the camera above the water, and the direction it's looking, you simply mirror these in the water plane. So the position of the camera for the reflection camera becomes underwater, while the direction is exactly the same, just it's verticle components are flipped.

The project comes when applying the texture to the quad(s) that form the water plane.

[edit]
I did a search, and well. I found this (I seriously can't even remember making that post) and also this which I also don't remember replying to - however, there was a thread all about it, that got really really indepth but I just can't find it! arrgggh!

| - My project website - | - email me - |

[edited by - RipTorn on March 10, 2004 11:57:49 PM]

Share this post


Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!