Data Realms Fan Forums
http://45.55.195.193/

Surface normal, and realistic reflections !!Images!!
http://45.55.195.193/viewtopic.php?f=1&t=19969
Page 1 of 1

Author:  findude [ Sun Oct 17, 2010 12:51 pm ]
Post subject:  Surface normal, and realistic reflections !!Images!!

I noticed particles don't reflect right, that is, according to the law of reflection:

Image

So, it shall be fixed!

Image

The dotted lines are the surface normal estimations, fire puffs the hitposition of the first raycast.

Pastebin of functional part for your convenience: http://pastebin.com/nP8Yt8R5

How the surface normal is estimated:
Image
And how the reflection angle from original is calculated to be used by Vector:RadRotate()
Image
Actually, it would be 90-alpha, but in radians 180 is conveniently Pi.


Because all the actors in Cortex Command are meth addicts and shake all the time, this isn't that good for beams.
The constant jittering means it'll spread all over the place.
Projectiles however, should do well.

Feel free to use this for anything you want to bounce around.


Attachments:
File comment: Proof of concept
Reflection.rte.zip [1.09 KiB]
Downloaded 336 times

Author:  findude [ Sun Oct 17, 2010 11:04 pm ]
Post subject:  Re: Surface normal, and realistic reflections !!Images!!

Nope, try commenting out the script from the beam, and shoot it at a straight, vertical wall on an angle.

The angle of reflection is the same as angle of incidence, but it is measured from the normal, not the face itself.

It's wrong.

Author:  Grif [ Mon Oct 18, 2010 3:02 am ]
Post subject:  Re: Surface normal, and realistic reflections !!Images!!

Makes you wonder just what bastardized math data is actually using.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/