Jump to content

How to display mesh vertex colors as 100% emissive?


inteja
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

*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!  :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...