asperger Posted August 19, 2018 Share Posted August 19, 2018 Is there any way to make a high quality glowing sphere? At first I thought I could use the glowlayer but that only seems to work for imported meshes? https://www.babylonjs-playground.com/#LRFB2D#1 Then last experiment with the HighlightLayer by increasing the blur size: https://www.babylonjs-playground.com/#1KUJ0A#137 Now with the latter the quality is really bad. Any recommendation? Edit: I did manage to create a shader that works with three.js but im not sure how to translate it to make it work with babylon.js. If anyone can manage to make it work with babylon then we have a high quality glow thats fast. <script id="vertexShader" type="x-shader/x-vertex"> uniform vec3 viewVector; uniform float c; uniform float p; varying float intensity; void main() { vec3 vNormal = normalize( normalMatrix * normal ); vec3 vNormel = normalize( normalMatrix * viewVector ); intensity = pow( c - dot(vNormal, vNormel), p ); gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); } </script> <script id="fragmentShader" type="x-shader/x-vertex"> uniform vec3 glowColor; varying float intensity; void main() { vec3 glow = glowColor * intensity; gl_FragColor = vec4( glow, 1.0 ); } </script> Quote Link to comment Share on other sites More sharing options...
Raggar Posted August 19, 2018 Share Posted August 19, 2018 The glowLayer works fine with created meshes. http://playground.babylonjs.com/#IEW571 asperger 1 Quote Link to comment Share on other sites More sharing options...
asperger Posted August 19, 2018 Author Share Posted August 19, 2018 Weird. It seems I didnt see that part in the documentation: glowLayer.addIncludedOnlyMesh(mesh); Interesting. I can also control the intensity and texture quality. Pretty great. The performance is far better than that of the HighlightLayer. Quote Link to comment Share on other sites More sharing options...
Raggar Posted August 19, 2018 Share Posted August 19, 2018 11 minutes ago, asperger said: Weird. It seems I didnt see that part in the documentation: glowLayer.addIncludedOnlyMesh(mesh); Interesting. I can also control the intensity and texture quality. Pretty great. The performance is far better than that of the HighlightLayer. It will still work without that function. You might have forgotten setting an emissiveColor? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted August 20, 2018 Share Posted August 20, 2018 4 hours ago, asperger said: The problem is that the glow layer always seems to be in the foreground. You can put things in front of the glow layer using the rendering group id (GlowLayer defaults to -1): http://playground.babylonjs.com/#IEW571#1 https://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#rendering-groups Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.