I encoded the colors and brightnesses of stars in the pixels of an image texture. The colors are in the first three components of the pixels' (r,g,b,a) arrays. The brightnesses are in the fourth component (a).

I subsequently connected the Color port of the Image Texture node to the Color port of an Emission node. (See image below.) It worked and the stars have the appropriate colors.

enter image description here

I also connected the Alpha port of the same Image Texture node to the Strength port of the Emission node. My hope was to use the alpha values to set the relative brightnesses of the stars. This... doesn't seem to work.

I did a test in which I set all the alpha values to 0. This would correspond to an emission strength of zero, which would make the stars dark. Yet, despite the alpha values being zero, the output of the Alpha port seems to be nonzero, since it makes the stars very bright.

So I'm wondering—what exactly is the output of the Alpha port and should I not use it to encode emission strength? Why would it output any value other than the 0 that I encoded in the (r,g,b,a) arrays of the image texture?

Many thanks in advance for any help you can give!

EDIT: I'm noticing now that the alpha values in my image texture affect the emission strength when the two nodes are connected via the Color ports alone. This seems strange, since I expected the Color port of the Emission node to accept only the emission color, not its strength.

The other possibility is that it's the transparency of the emission color that is being affected so that lower alpha values make the star look dimmer. However, when I disconnect the Color port and try to set the Emission color manually, setting its Alpha value to zero has no effect.

Confused! Any light shed on this would be greatly appreciated...

EDIT: Added screenshot of simplified node setup.

  • $\begingroup$ It would help if you could share some screenshots of your nodes, image, and results. $\endgroup$ – Rich Sedman Aug 15 '18 at 7:07
  • $\begingroup$ can you share that image or an equivalent one so we can try the same? $\endgroup$ – rob Aug 16 '18 at 9:23
  • $\begingroup$ I would love to, but the image texture (which I assume is the one you need to see) is generated with Python code, and I sadly don't know how to save it to an external file to share. I assume that the image is simply packed with the model—maybe if I look in the Textures folder of the model? I'll upload it if I can figure this out. Thanks for bearing with me as I feel my way around in the darkness :D $\endgroup$ – Alex Aug 16 '18 at 22:24
  • $\begingroup$ One issue could be that your Combine XYZ is set to X (generated by dividing by the number of pixels) and '1.0' for both of the Y and Z coordinates. The thing is that [x,1.0,1.0] in on the boundary of the image (since each coordinate runs from 0.0 to 1.0). Try simply changing the 'fixed' Y and Z coordinates to 0.5 and 0.5 respectively. This will place the vector coordinate right in the middle of the row of pixels. As it stands you are picking the pixel position at the very edge of the image space and this will be confllicting with the 'Clip' (since it's on the clip boundary) and interpolation. $\endgroup$ – Rich Sedman Aug 16 '18 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.