Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Suggestion / Idea  OBI7 Surface Texture Rendering (Lava) discussion
#11
(08-05-2024, 01:24 PM)josemendez Wrote: Done! Just need to clean it up and expose parameters in the UI. This will also allow for textured opaque fluids, which is interesting for lava/mud and similar stuff. Will be included in the RC around next monday, maybe you won't need a time capsule Guiño.



Damnnnnn bro, yes, I'm making Lava level, this is so good whooo  Gran sonrisa !
Reply
#12
Just to show how it looks in the context of foam generation, driving texture intensity using vorticity/velocity.

Reply
#13
(10-05-2024, 07:57 AM)josemendez Wrote: Just to show how it looks in the context of foam generation, driving texture intensity using vorticity/velocity.


So good man! The sim now looks so detailed.
Reply
#14
This is now available in the latest RC, which you can download making use of the same links sent to you when you applied to the beta. I've also updated the manual to reflect these changes.

Fluid particles now calculate and carry the amount of air trapped in them, this is called the global foam potential. You have parameters to control this in the ObiSolver component, under the Advection foldout.

http://obi.virtualmethodstudio.com/manua...mpotential

This global foam potential is used by fluid renderers to modulate the intensity of diffuse textures on transparent fluids:

http://obi.virtualmethodstudio.com/manua...ering.html
Reply
#15
(16-05-2024, 01:46 PM)josemendez Wrote: This is now available in the latest RC, which you can download making use of the same links sent to you when you applied to the beta. I've also updated the manual to reflect these changes.

Fluid particles now calculate and carry the amount of air trapped in them, this is called the global foam potential. You have parameters to control this in the ObiSolver component, under the Advection foldout.

http://obi.virtualmethodstudio.com/manua...mpotential

This global foam potential is used by fluid renderers to modulate the intensity of diffuse textures on transparent fluids:

http://obi.virtualmethodstudio.com/manua...ering.html

Hi bro, glad to have the new exciting feature!
Look at this video, now we have 3 types of fluid in a scene! Lava + water + paint   Gran sonrisa
Wow the visual upgrade is very apricated! thank you!




Still, there are some problems and questions, first pls download this
packagehttps://drive.google.com/file/d/1DQ1cTtP...sp=sharing
Beware, the package will overwrite your IndirectOpaque shader!
Unity 2022.3.29f1, URP 14, see video to see the instructions to test the Lava.

Let's get to the problems:
Still cannot get over the resetting looks of the surface texture:
Low advect time scale result in bad resetting looks, high value result in extreme stretching.
The effect of resetting makes it look like a pulsing organic surface, really distracting.

Wind does not work correctly with fluid particle mass:
You can drag the wind intensity slider on screen and see, at wind str 10, the lava particles are flown away like it is as light as the character hair (mass 0.5), but actually the mass of Lava is at a massive value 250kg per particle.

Can you set the transparent fluid render on top of opaque fluid?
Currently the transparent fluid will render the dark gray scene floor behind it. It should render the lava behind it, or any opaque fluid.

The performance hiccup
At some part of the play duration, there is 1% fps at 1fps, which is a very bad frame drop. The scene only has 3 fluid emitters, 1 cape, and character ObiBone (hair), it should not be that bad.

Still have issue with toggle emitter's gameobjects sometimes crash the game.
Click "Toggle Lava" button a few times in game build and expect a crash.
Yes it is fixed!

Pointer to the way to make a type of fluid to cool down the Lava?
I know what I should look into is the Raclette sample, but still, it does not have many comments in code to see what is going on.
Like make use of userdata, a value to give it a cool or hot, and the shader can use that value to lerp the emission.

Wishlist for the feature to directly reference a custom fluid material in the ObiFLuidSurfaceMesher or Emitter for every emitter.
For now, I overwrite the IndirectOpaque shader to give the fluid that Lava emission feature, which should be a local material, not globally used by all the fluid right?

All and all, thank for all the upgrades and hard work bro.
Best regards!
Reply
#16
(16-05-2024, 05:17 PM)spikebor Wrote: Still cannot get over the resetting looks of the surface texture:
Low advect time scale result in bad resetting looks, high value result in extreme stretching.
The effect of resetting makes it look like a pulsing organic surface, really distracting.

The advection model is optimized for foam-like stuff, where the pulsing at rest is used to hide texture repetition. Open up ObiFlowMapping.cging and comment out lines 17 and 18:

Code:
flowUV1 += (time - phase1) * jump;
flowUV2 += (time - phase2) * jump + 0.5;

That should improve the resetting look.

(16-05-2024, 05:17 PM)spikebor Wrote: Wind does not work correctly with fluid particle mass:
You can drag the wind intensity slider on screen and see, at wind str 10, the lava particles are flown away like it is as light as the character hair (mass 0.5), but actually the mass of Lava is at a massive value 250kg per particle.

Wind in fluids is scaled by the fluid's atmospheric drag.

(16-05-2024, 05:17 PM)spikebor Wrote: Can you set the transparent fluid render on top of opaque fluid?
Currently the transparent fluid will render the dark gray scene floor behind it. It should render the lava behind it, or any opaque fluid.

Your IndirectOpaque shader is set to "transparent" in URP. Set it to opaque for it to render correctly behind transparent objects.

(16-05-2024, 05:17 PM)spikebor Wrote: The performance hiccup
At some part of the play duration, there is 1% fps at 1fps, which is a very bad frame drop. The scene only has 3 fluid emitters, 1 cape, and character ObiBone (hair), it should not be that bad.

I'm unable to reproduce any performance drops. Could you share a capture of your profiler in timeline mode, during one of these hiccups?


(16-05-2024, 05:17 PM)spikebor Wrote: Pointer to the way to make a type of fluid to cool down the Lava?
I know what I should look into is the Raclette sample, but still, it does not have many comments in code to see what is going on.
Like make use of userdata, a value to give it a cool or hot, and the shader can use that value to lerp the emission.

For your specific use case you could look into driving the particle's color using userData. You just copy the contents of the userData array to the color array, making any conversion you deem necessary. Particle color gets passed on to the mesh vertices, so you could then write a custom shader that uses the color of the particles to drive texture emission and cool down the lava.

Note it is not possible to access arbitrary per-particle data from a shader. The reason is only vertex data is accessible to a shader, and for things like userData (or other particle properties like mass or density) to be directly accessible from a shader they would need to be averaged during fluid mesh construction and packed into the vertex format.

Currently, fluid vertices store fluid velocity, normal and color. It's not within our plans to add more data to the vertex format, as storing more data would increase the size of vertices and hence the memory usage of chunks, making it harder to have larger amounts of fluid. For this reason we've strived to keep the vertex size as small as possible: color is compressed and normals use octahedral encoding.

(16-05-2024, 05:17 PM)spikebor Wrote: Wishlist for the feature to directly reference a custom fluid material in the ObiFLuidSurfaceMesher or Emitter for every emitter.
For now, I overwrite the IndirectOpaque shader to give the fluid that Lava emission feature, which should be a local material, not globally used by all the fluid right?

This is already possible, you can change the mesher's material type from Opaque or Transparent to "Custom", and provide an entirely custom material. Note that the shader you use still needs to access vertices in a specific way since Obi uses a compressed vertex format for fluids. See the manual for an example of a minimal shader (scroll to the bottom of the page):
http://obi.virtualmethodstudio.com/manua...ering.html
Reply
#17
(21-05-2024, 09:25 AM)josemendez Wrote: The advection model is optimized for foam-like stuff, where the pulsing at rest is used to hide texture repetition. Open up ObiFlowMapping.cging and comment out lines 17 and 18:

Code:
flowUV1 += (time - phase1) * jump;
flowUV2 += (time - phase2) * jump + 0.5;

That should improve the resetting look.


Wind in fluids is scaled by the fluid's atmospheric drag.


Your IndirectOpaque shader is set to "transparent" in URP. Set it to opaque for it to render correctly behind transparent objects.


I'm unable to reproduce any performance drops. Could you share a capture of your profiler in timeline mode, during one of these hiccups?



For your specific use case you could look into driving the particle's color using userData. You just copy the contents of the userData array to the color array, making any conversion you deem necessary. Particle color gets passed on to the mesh vertices, so you could then write a custom shader that uses the color of the particles to drive texture emission and cool down the lava.

Note it is not possible to access arbitrary per-particle data from a shader. The reason is only vertex data is accessible to a shader, and for things like userData (or other particle properties like mass or density) to be directly accessible from a shader they would need to be averaged during fluid mesh construction and packed into the vertex format.

Currently, fluid vertices store fluid velocity, normal and color. It's not within our plans to add more data to the vertex format, as storing more data would increase the size of vertices and hence the memory usage of chunks, making it harder to have larger amounts of fluid. For this reason we've strived to keep the vertex size as small as possible: color is compressed and normals use octahedral encoding.


This is already possible, you can change the mesher's material type from Opaque or Transparent to "Custom", and provide an entirely custom material. Note that the shader you use still needs to access vertices in a specific way since Obi uses a compressed vertex format for fluids. See the manual for an example of a minimal shader (scroll to the bottom of the page):
http://obi.virtualmethodstudio.com/manua...ering.html

Thanks for all the answers. I think with those infos I can make my lava cool now Gran sonrisa 
Btw currently I'm on other tasks, will post more when I get back to the project.
Reply