3DGS : Point cloud effect on start
-
-
- New
- Official Post
Hi,
there is an explicit example for such effects included:
Source:
krpano Code EditorIt works by using a WebGL GLSL shader that can dynamically modify the parameters of a single splat.
E.g. here the default and most simple shader - it scales a splat depending on the distance from the world-center:
Code
Display More<action name="splats_unveil_shader_default" type="glsl"><![CDATA[ uniform float unveil_range; uniform float unveil_blendrange; uniform float unveil_progress; void splatshader (inout vec4 pos, inout mat3 mx, inout vec4 color) { // distance from the world/model center float d = length(pos.xyz); // distance-based blend factor float blend = 1.0 - clamp((d - unveil_progress * (unveil_range + unveil_blendrange) + unveil_blendrange) / unveil_blendrange, 0.0, 1.0); // scale the splats, but not to zero mx *= max(blend, 0.000001); } ]]></action>The 'uniform' variables (e.g. range and progress) in this shaders are parameters that can be controlled from xml/actions/js. E.g. The unveil effect is done by animating (tweening) the progress value.
See here the <image> <splat> declaration for details - the shader is set, the parameters are set and in the onloaded event the animation is started:
Code
Display More<image> <splats ... shader="get:action[splats_unveil_shader_default].content" unveil_range="2500" unveil_blendrange="200" unveil_time.number="3.0" unveil_progress="0" antialias="link:unveil_progress:mix(1.0,0.3,unveil_progress)" onloaded="tween(unveil_progress,1,get(image.splats.unveil_time),smoother, layer[playbutton].text='Play'; );" /> </image>
That means just add the shader code to the xml, and the parameters to the <splats> element,(and probably adjust the parameter like range to your model) and it should work.And because basically every parameter of splat can be dynamically modified at runtime, various effects are possible. You can use the included shaders or try creating own ones.
Best regards,
Klaus
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!