Jump to content
  • Advertisement
Sign in to follow this  
SpikeViper

Unity Lighting and effects with a texture atlas

This topic is 843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Since the last time I've been here, my game's going along nicely. I have planets made of blocks generated on the fly. I use a texture atlas to supply the textures for all of the different block types I have. And here comes the problem. I want some object to look metallic and shiny, while others will be quite dull. I also want some blocks to glow (Uranium, lava, etc.). Using unity I tried using an emission map, but it bled the light into different blocks in the atlas and, even worse, since the object was dynamic I wasn't able to have the light effect other blocks. What are some ways to go around giving all of these blocks different properties? I was thinking about passing values to the mesh sort of how Vertex Colors work, but I understand in unity the amount of data you can send to a mesh is limited. Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
I am not sure what the problem is. How is unity bleeding light into the atlas?

It should not be emitting anything in areas that don't have that effect. Could you post a picture?

Share this post


Link to post
Share on other sites

bleeding.png

 

 

As you can see, the red (that's supposed to be a single block) glowing is moving onto other blocks on the atlas. The blocks are even separated by 32 pixels to prevent texture bleeding. It appears unity does not actually emite light out of these - it just edits the texture to look like it is. On the bottom right you can see that the red block lights up about 1/6th of the entire atlas. But lighting is only one problem. I also want each block to have their own smoothness and metallicness values. I want to put these values in as you would put in vertex colors - per vertex so I can control each block, or I could possible use a specular map. The emitting blocks also don't light the blocks around them.

Edited by SpikeViper

Share this post


Link to post
Share on other sites

Fixed the emission bleeding by making the rest of the texture black (had it set to transparent). Made it glow using a Bloom script.

 

Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!