![]() ![]() the z coordinate as a function of x and y). This is because the water surface is represented as a 2D height-map, representing the displacement from equilibrium (i.e. The method of water simulation that is used here doesn't lend itself to simulating the effects of things like water tension or breaking waves. Unfortunately the effects that you describe are nontrivial. Graphics programming is all smoke and mirrors if it's easier to approximate something using an unphysical process that looks right, people will favour that over an exact simulation that takes far more computing power. It's not impossible that sort of thing will make an appearance, though I'd still be surprised. at the tip of a crack just before it propagates. There are lots of multi-scale modelling techniques though, where you directly model the system on the atomic scale in just a few small volumes, e.g. Even at one transistor per molecule, the numbers just don't add up. At best, todays chips have several billion transistors (5e9). There are quite simply too many atoms: there's 1 mole (6e23 atoms) in 18g of water. that in another few decades the individual granularity of those particles will become so small and so numerous that we'll basically be modeling liquids and solids at the molecular level?Īlso not a graphics programmer, but I am a scientist who has model liquids and solids at the molecular level–a lot of this is doable today, but I doubt it'll ever be applied directly to a macroscopic graphics engine. To implement this effect we take depth information as input and blurs a mask generated from the depth map along radial lines emanating from the light source.Īs you can see, as more simulation shader added into the pipeline, the performance evetually drops.īut all the fps is above 60, which means our WebGL Water is truly fast and real-time.>. ![]() God rays is a Volumetric light scattering effect due to shadows. Now the reflection and refraction positions are not right, to be fixed in the future. To render a reflection texture from the point of view of reflection point, and use this texture for shading the water. This can be turn on under GUI debug image under draw_obj_reflect. Then in the shader, transform vertex into the light view space, determine shadow by the following rule This is done by rendering a depth texture a from the point of view of light. Load the obj by Threejs obj loader, then shade it by diffuse BRDF.Īs triangle test is very expensive in the shader, we use Shadow Map technique instead of raytraced shadow. This shader calculates wave pattern based on sphere movement. The wave propagates and attenuates due to this shader.ĪverageHeight = (sum of 4 neighbouring Heights)/4 The normal is calculated and shaded correctly after this shader. Height.y += drag (drag is based on dist to click center) the speed is also attenuatedĪd the end, the texture is passed into water mesh shaders as useful information to renderĪs you can see, the height of vertex is changed after this shader. In the step simulation, speed.y is calculated based on new height and normal information. In the Normal Map shader, normal.x and normal.z is updated with new height information. In the Height Map shader, or the sphere move simulation, height.y is updated by mouse click/sphere movement. To complete water simulation, a gl.RGBA float texture is used to store the simulation data. Use Perlin noise as a noise texture to change water height based on noise. Volumetric light scattering due to shadows ![]() Use bounding sphere to interaction with water, without triangle test, so that performance is maintained fast and realtime. And we get the caustic value by compare the two refract rays, Then write the caustic value to the caustic map.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |