PDA

View Full Version : Without Shaders



ajmrm
04-11-2003, 05:09 PM
Hello,
I am doing my project in computer graphics. I am new to OpenGL programming, working on it for the past 1 year only.

I am doing a project for driving simulation from a driver point of view. I created an effect with a dynamic cubemap.

Recently I've implemented the flow of water droplet in a windshield of the car. Here I used sphere to represent a water droplet.

I am wondering how to make a sphere looks like water. As you know how the water droplet looks like? I am supposed to finish my project by this April and still struggling to do it so. can you please help me to do this or give me some idea?

I am went thru Shader but very difficult to understand. I've read about Raytracing to and my supervisor told me to use raytracing so the sphere looks so transparent that of water droplet.

Please suggest me. Looking forward for your reply.
thanx
regards
Riaz.

JustHanging
04-12-2003, 01:19 AM
Hi,

Do you know billboards? I think that's the best and easiest way to go, basically you just have a semi-transparent image of a water droplet, and you rotate it so that it's always facing the viewer. This way it appears as a sphere, but it's actually just a single polygon. This should come in handy since you're propably supposed to have lots of them and using a sphere for each might get a little expensive.

Make the droplet less translucernt towards the edges to approximate the fresnel effect and use colors from the enviroment to create the illusion of reflection. The droplet (without translucency) should look like a spheremap of a typical enviroment.

-Ilkka

jwatte
04-12-2003, 07:06 PM
Don't ray-trace. Render the scene from the point of view of the droplet, then render the droplet with environment mapping, but warp the texture coordinates towards the viewing direction a bit. That way, it'll look like refraction.

Then apply a little bit of reflection, and you're done.

You can get better quality refraction if you actually simulate it in the vertex shader and tesselate highly (i e, a 500 vertex water drop :-)

The key realization is that, once you have a cube map rendered from the point of view of the water drop, you have all the information you need. Another key realization is that, in a real car, there's something on THIS side of the windshield, that needs to show up in your water drop.

ajmrm
04-14-2003, 04:32 AM
Hi.
Thanx for your reply.

I applied Environment mapping and trying to make it realistic.

Now I have another question.
1. When I am rendering the scene, how to make direct animation like flow of water from different locations. Let say one drop have to flow more than 1 second and some need to flow within 1 second from top to bottom. So how will I track it? More over when I am rendering the scene again the previous water droplet vanishes.

Please advise me.

thanx
regards

knackered
04-14-2003, 04:53 AM
Look at the following xbox games:-
MotoGP (by Climax)
Colin McRae Rally 3 (by Codemasters)

MotoGP has the best rain-on-windscreen effect I've ever seen.
You'll see that it won't be that hard to emulate too.

JustHanging
04-14-2003, 06:02 AM
Here's another idea:

You have a water-on-windshield texture. Let this be a kind of a heightmap where black implies to no water and white is the maximum amount of water, say a couple of millimeters.

This texture is dymanic, so you modify it every frame using render-to-texture. In practice you warp it a bit according to the windshield shape and car speed. You can do this by drawing the old texture on a grid which has it's vertices slightly moved away from the center. Then replace the old texture with the image of the warped one. When you repeat this every frame, you'll get the effect of the drops moving to the sides.

On top of the warped texture, you could also add a dimmed version of the old, unwarped texture so the droplets cause traces on the windshield. You can use a greyscale noise texture to do the dimming so the traces don't get too perfect.

Now that the windshield animation is automated, all you have to do is to add new white spots every now and then where the new droplets hit the windshield.

The last part is to render the grayscale heightmap texture so it looks like water. You can use emboss bumpmapping to get some lighting on it. By subtracting the grayscale texture from it's slightly offset copies you can also get an approximation of it's partial derivatives, which you can use to offset enviroment map reads, and maybe to approximate the fresnel effect somehow too.

God that's complicated! I hope you understood something...

-Ilkka

knackered
04-14-2003, 08:00 AM
Mmm, I think all MotoGP does is maybe something like this:-
1) render ultra simple version of the view ahead into a texture (you really only need the horizon to be clearly defined).
2) render a few tiny little low tesselated mesh patches here and there over the main view, with the texture coordinates upside-down.
3) Update this texture every 3 or 4 frames.

Simple and fast - but very effective.