inteja Posted March 30, 2018 Share Posted March 30, 2018 I have a dynamically generated "celestial star sphere" mesh of independent triangles each mapped with an opacity texture representing the star. The underlying vertex colors of each triangle (representing the color of real stars) shine through but currently the entire mesh is affected by lighting and I can't set the emissive color on the material otherwise it'll wash out the vertex colors. I want the vertex colors to always contribute 100% of the triangle color, but masked by the opacity texture and unaffected by lighting. Is this possible somehow? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 30, 2018 Share Posted March 30, 2018 Hiya inteja, good to see you again. Not sure if helpful, but you can set vertexColors to ANY "magnitude" (within reason). Would power-amplifying (up-scaling) the vertex colors... help you? https://www.babylonjs-playground.com/#1UHFAP#196 Lines 69-79, where 'p' = power. Unnatural saturation. (I spit a little when I typed that) I'm not responsible if your computer monitor melts from photon overload. heh. Stay tuned... smarter people than I... are nearby. Quote Link to comment Share on other sites More sharing options...
inteja Posted March 30, 2018 Author Share Posted March 30, 2018 Thanks @Wingnut I didn't know you could do that - I thought colors would be internally clamped in the range 0.0-1.0. It helps a bit but still affected by lighting which means the star colors aren't accurate to the star data (vertex color), which is ideally what I'm after. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 30, 2018 Share Posted March 30, 2018 *nod*. Yeah, you could use a vertexColor-to-Texture "ratio" adjuster... or something. Have you tried strange things like using the same emissiveTexture or diffuseTexture... in the opacityTexture channel? That seems good and demented. Don't do a mat.emissiveTexture = mat.opacityTexture. Actually make a new Babylon.Texture for the opacityTexture, but use the same URL. That way, both textures their own .level property, and other things. (just guessing at ideas, here). You want the stars to be complete self-illuminated, eh? No lights affecting them. (be sure to notice light.excludedMesh array, as needed.) But yeah... you almost need more control over how vertexColors are summed-into the final result. Weird challenge. Issue still open, everyone. Help welcome! Quote Link to comment Share on other sites More sharing options...
inteja Posted March 30, 2018 Author Share Posted March 30, 2018 Hi @Wingnut I'm not able to use textures for color, in any channel because each star color is unique but it's all one mesh of ~5000 triangles for the naked-eye visible stars. So I figure my only option is vertex colors - I just can't seem to light them 100%. Hmmm, maybe I could try the new glow layer ... will investigate that also. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 30, 2018 Share Posted March 30, 2018 Ahh, ok... so vertexColors only. You've tried scene.ambientColor of gray, and then star.material.ambientColor = something? mat colors... mixed with vertexColors. Do they mix? I should go do some tests. I need to eat, though. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted March 30, 2018 Share Posted March 30, 2018 Hi @inteja I think what you need is emissiveColor & disableLighting https://www.babylonjs-playground.com/#1UHFAP#197 Erm, i miss-read Quote Link to comment Share on other sites More sharing options...
inteja Posted March 30, 2018 Author Share Posted March 30, 2018 Feeling a bit silly now, and thought I'd tried this already, but simply setting starMaterial.emissiveColor to white does the trick - this seems to result in mesh being unaffected by lights and also doesn't wash out mesh vertex colors. Wingnut 1 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.