0
\$\begingroup\$

enter image description here

I'm still working at making imposters for my Unity scenes. Here I am attempting to make a large block of stadium seating, using the one seat mesh as shown.

I'll try to explain in full what Ive done so far:

  1. Imported 3d mesh of seat
  2. Created RenderTexture 'seat' (default format R8G8B8A8_UNORM)
  3. Added new Orthographic camera in front of seat. (settings: Clear Flags=Solid Color; TargetTexture='seat'
  4. Created some quads and aligned them so I can see the textured side.
  5. Gave the quads a new material 'seat'.

I've gone through many of the settings in the Material and other places changed many things here and there such as 'transparent' or 'cutout' and lots of the other settings but cannot get rid of the magenta color in the seating textures I created.

Also tried making that color alpha 0 but it had no effect. And tried various colors as transparent (magenta, white, black).

Am I doing this completely wrong? Hopefully I am just missing some small setting. Ideally somewhere I can just set the magenta color to mean transparent pixels.

Really do need help here honestly have been trying very hard to achieve this alone but not getting anywhere fast.

\$\endgroup\$
8
  • \$\begingroup\$ Usually we'd clear to zero alpha and then use alpha transparency. Color-key transparency really isn't used much outside of retro sprite games these days. \$\endgroup\$
    – DMGregory
    May 16 at 13:32
  • \$\begingroup\$ Ok thanks, I did try that to start with. But it seemed to ignore that I set the clear color to A=0 \$\endgroup\$ May 16 at 13:33
  • \$\begingroup\$ Oh wow it worked :D \$\endgroup\$ May 16 at 13:34
  • \$\begingroup\$ I didnt have the correct cocktail of settings :D So i changed the alpha to 0 in the Imposter_camera and the material is set to Sprite Diffuse right now, and it now works somehow haha \$\endgroup\$ May 16 at 13:35
  • \$\begingroup\$ Best way for future reference seems to be 'CutOut' in the Standard Shader. And of course Alpha to zero in the Camera Clear \$\endgroup\$ May 16 at 13:38
1
\$\begingroup\$

So the solution turned out to be quite simple. After doing all the steps I mentioned in the question, you will need to make sure the camera that you use to generate the RenderTexture has it's Clear Flags set as 'Solid Color', then that color should be set as white, with Alpha=0.

Then you'll have created a material for your quads, which will take the RenderTexture as the Albedo. I used the Standard Shader and just set the Rendering Mode to 'cutout'.

It now renders the image perfectly without the background being visible.

My next challenge which I am sure I will need help with but will try alone is to figure out a system of choosing which angle of the seat will be displayed on each quad. When there is a stadium full of seats, and the main camera is moving about, there will need to be some way for each quad to decide what texture to display. I am sure to find this a huge challenge.

All the best

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.