Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Feedback Change how to draw particle
#2
(25-01-2023, 07:28 AM)spikebor Wrote: Hi dev.
Correct me if I'm wrong, for now I think the particle rendering is only for debugging and adjustment to get desired physics result.

Hi Spikebor!

In Obi Rope yes, but in Obi Fluid it is the main rendering method as used to draw both granulars and fluid.

(25-01-2023, 07:28 AM)spikebor Wrote: So why not use Unity's Handle API to do it?

Because handles are extremely slow compared to the current method, and can only be used in-editor.

(25-01-2023, 07:28 AM)spikebor Wrote: My current problem with it is my Unity 2022.2.2f1 URP 14, Obi Particle shader does not render.

Are you using the URP particle shader? You can find it in Obi/Resources/ObiMaterials/URP, as stated in the manual.


(25-01-2023, 07:28 AM)spikebor Wrote: I do not wish to tell you guys to fix this shader, since it will break again when Unity makes changes to their rendering.
Handle API will not break, it can draw mesh with custom shader.
The sphere mesh can be referenced in code (instead of currently generated in shader?), and the shader can just be a simple Lit shader made in Shader Graph.

You can't use a custom shader to render particles unless you use a mesh for each particle, which would be very slow for large amounts of particles (it's not unusual for Obi to deal with +5000 particles). In upcoming updates that allow for GPU simulation, you can simulate as many as 100k particles so rendering speed becomes even more of a bottleneck.

The included particle shader implements something called "screen-space ellipsoid splatting": each particle is just a camera-facing quad generated in the vertex shader, and the surface of the sphere is determined using raytracing in the fragment shader. This is many orders of magnitude faster than rendering spheres using the Handles API since each particle is only 2 triangles and they're all rendered in a single draw call.

If you're curious about this technique you can read more here:
http://www.inf.tu-dresden.de/content/ins...ipsoid.pdf

If you want to use an arbitrary mesh to render each particle, with a custom ShaderGraph shader, you can use the ObiInstancedParticleRenderer component instead. Note the shader you use must support GPU instancing, and this will be slower than using ObiParticleRenderer.

kind regards,
Reply


Messages In This Thread
Change how to draw particle - by spikebor - 25-01-2023, 07:28 AM
RE: Change how to draw particle - by josemendez - 25-01-2023, 08:45 AM
RE: Change how to draw particle - by spikebor - 25-01-2023, 09:03 AM
RE: Change how to draw particle - by josemendez - 25-01-2023, 09:06 AM
RE: Change how to draw particle - by josemendez - 25-01-2023, 09:04 AM
RE: Change how to draw particle - by spikebor - 25-01-2023, 09:09 AM