Closed coderextreme closed 4 months ago
There exists examples how to use shaders with ParticleSystem nodes:
https://github.com/create3000/media/tree/main/docs/examples/ParticleSystems/PointEmitter https://github.com/create3000/media/tree/main/docs/examples/ParticleSystems/ParticleSystem
In each folder there is a Zip file, you can download and examine. The PointEmitter example is probably more easier to understand.
Both example can also be examined in Playground: https://create3000.github.io/x_ite/playground/?url=https://create3000.github.io/media/examples/ParticleSystems/PointEmitter/PointEmitter.x3d https://create3000.github.io/x_ite/playground/?url=https://create3000.github.io/media/examples/ParticleSystems/ParticleSystem/ParticleSystem.x3d
⚠️ Also have a look at the Instancing section here, which is important for ParticleSystem and InstancedShape nodes with shaders: https://create3000.github.io/x_ite/custom-shaders/#instancing
Hmm my ParticleSystem works fine without the ComposedShader, and my ComposedShader works fine without the ParticleSystem.
The thing I haven’t tried is embedded shaders, not external.
On Mon, Apr 22, 2024 at 4:17 AM Holger Seelig @.***> wrote:
There exists examples how to use shaders with ParticleSystem nodes:
https://github.com/create3000/media/tree/main/docs/examples/ParticleSystems/PointEmitter
https://github.com/create3000/media/tree/main/docs/examples/ParticleSystems/ParticleSystem
In each folder there is a Zip file, you can download and examine. The PointEmitter example is probably more easier to understand.
Both example can also be examined in Playground:
⚠️ Also have a look at the Instancing section here, which is important for ParticleSystem and InstancedShape nodes with shaders: https://create3000.github.io/x_ite/custom-shaders/#instancing
— Reply to this email directly, view it on GitHub https://github.com/create3000/sunrize/issues/5#issuecomment-2068899151, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ552KQTV5QOCPMR75ZTY6TIT5AVCNFSM6AAAAABGRTCNEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRYHA4TSMJVGE . You are receiving this because you authored the thread.Message ID: @.***>
It makes no difference if you use embedded shaders or externals. Do as you like.
As you can see here https://create3000.github.io/x_ite/custom-shaders/#particlesystem you must multiply the x3d_Vertex
with x3d_ParticleMatrix
:
uniform mat4 x3d_ProjectionMatrix;
uniform mat4 x3d_ModelViewMatrix;
attribute vec4 x3d_Particle;
attribute mat4 x3d_ParticleMatrix;
attribute vec4 x3d_Vertex;
void
main ()
{
gl_Position = x3d_ProjectionMatrix * x3d_ModelViewMatrix * x3d_ParticleMatrix * x3d_Vertex;
}
I think that's the biggest pitfall.
Ah, I didn’t even realize that x3d_Particle and x3d_ParticleMatrix existed!
Mucho thanks, I’ll create new shaders!
On Mon, Apr 22, 2024 at 2:24 PM Holger Seelig @.***> wrote:
It makes no difference if you use embedded shaders or externals. Do as you like.
As you can see here https://create3000.github.io/x_ite/custom-shaders/#particlesystem you must multiply the x3d_Vertex with x3d_ParticleMatrix:
uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix; attribute vec4 x3d_Particle;attribute mat4 x3d_ParticleMatrix;attribute vec4 x3d_Vertex; void main () { gl_Position = x3d_ProjectionMatrix x3d_ModelViewMatrix x3d_ParticleMatrix * x3d_Vertex; }
I think that's the biggest pitfall.
— Reply to this email directly, view it on GitHub https://github.com/create3000/sunrize/issues/5#issuecomment-2070744886, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ56KV5Q6KVVJDGXIDCTY6VPWTAVCNFSM6AAAAABGRTCNEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZQG42DIOBYGY . You are receiving this because you authored the thread.Message ID: @.***>
Beauty!
[image: image.png]
Note that the x3d_ParticleMatrix is an "in" not an "attribute" per the documentation, if anyone is searching through GitHub issues.
Thanks!
John
On Mon, Apr 22, 2024 at 2:24 PM Holger Seelig @.***> wrote:
It makes no difference if you use embedded shaders or externals. Do as you like.
As you can see here https://create3000.github.io/x_ite/custom-shaders/#particlesystem you must multiply the x3d_Vertex with x3d_ParticleMatrix:
uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix; attribute vec4 x3d_Particle;attribute mat4 x3d_ParticleMatrix;attribute vec4 x3d_Vertex; void main () { gl_Position = x3d_ProjectionMatrix x3d_ModelViewMatrix x3d_ParticleMatrix * x3d_Vertex; }
I think that's the biggest pitfall.
— Reply to this email directly, view it on GitHub https://github.com/create3000/sunrize/issues/5#issuecomment-2070744886, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ56KV5Q6KVVJDGXIDCTY6VPWTAVCNFSM6AAAAABGRTCNEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZQG42DIOBYGY . You are receiving this because you authored the thread.Message ID: @.***>
See recent email.
ComposedShader works okay with Sphere Shape. ComposedShader doesn’t work with ParticleSystem, BoundedPhysicsModel, ExplosionEmitter
BoundedPhysicsModel works okay without ComposedShader.
Seems difficult.