Reflective water using shaders

Started by
16 comments, last by skow 20 years, 1 month ago
Ohh I don''t have to unproject just flip like:

   []camera    \     \      \     è \-------------water-------------     è /      /     /    /   []reflected view 


where the è is the same angle.

Will this work for water with waves? doesn''t seem like it would give the right reflection (dependent on the normal). I''ll read those, thanks for looking them up.
Advertisement
consider using glScalef(1.0, -1.0, 1.0);

[edited by - aaron_ds on March 11, 2004 10:00:17 AM]
...and watch all your normals flip around the Y axis aswell.
"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honor to meet you and you may call me V.".....V
quote:
joanusdmentia: ...and watch all your normals flip around the Y axis aswell.

im surprised whenever someone says that, because this has been discussed to death.

when using glScalef(1.0, -1.0, 1.0) use the following to correct all transformed normals:
glNormalize or glFrontFace(GL_CCW)/glFrontFace(GL_CW)
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
Fliping everything isn''t going to be a problem.

Can any one verify this will look decent with waves? It seems to me it wont as the normal of a point directly effects what is reflected.
I don''t spose has any one has some pointers in how to distort the texture in cg to get a wave like effect, or a link would be good.
Ocean/water rendering is a very large topic. There''s a very good topic about water rendering on gamasutra, can''t remember it''s name, though it''s very apparent if you browse through them. Also, Yann L did an IRC lecture, which extended this approach, perhaps someone can provide a link?

You have to remember that you''re unique, just like everybody else.
If at first you don't succeed, redefine success.
quote:Original post by aaron_ds
consider using glScalef(1.0, -1.0, 1.0);

[edited by - aaron_ds on March 11, 2004 10:00:17 AM]


This is a BAD way to do it. It only works if your waterplane is at 0 height and even then it has some problems. Just calculate mirrod camera position & direction and redner with that. A few dot/cross products won't kill you.

Yann L's water lecture

You should never let your fears become the boundaries of your dreams.

[edited by - _DarkWIng_ on March 12, 2004 7:20:50 PM]
You should never let your fears become the boundaries of your dreams.

This topic is closed to new replies.

Advertisement