Creating the glass in a red dot scope?

Hi, I’m currently building a rifle asset in Max and am confused about building the glass in the scope.

  1. Is the glass unwrapped on the same UV template as the rest of the rifle/scope?

  2. How/when do I apply the transparency?

  3. How do I add the reticle decals?

-Does the answer have something to do with Material ID’s?

Any help would be much appreciated…

Hi :slight_smile:

  1. Yes. The whole mesh is one UV map. (it could be done with multiples, but wouldnt be useful here)
  2. Create a transparency mask to cover the glass part
  3. Put them in the diffuse texture and maks them out in the transparency mask

Basically what I’ve shown here. But instead of an arm, you “hide” the glass part…


Thank you sir. If my game ever gets completed it will be largely due to the excellent help and advice I always receive here. Hopefully one day I’ll be able to return the favour.

Thanks again!

Edit: Having read up on this it would appear that the mask completely removes the glass. Although this isnt a problem when aiming, I was hoping to achieve a glass finish so that it would reflect light realistically when not in ‘aim-mode’. I can’t remember how games like Battlefield deal with this… am I being over ambitious, or can it be done without too much of a performance hit?

You’re welcome :slight_smile:

If you want to have tinted glass, change the Blend mode to translucent and give the mask a shade of gray instead of full black.
If you then leave the diffuse mask black where the glass part is, you can multiply the gray glass mask with a constant color and add it to the diffuse.
This way you have flexible control of the glass tint.
Or you bake the glass color into the diffuse. Less flexibility, but you save some shader instructions…

PS: If you want different blend modes for each (translucent for reticle and opaque for the gun), you need indeed split it into two material IDs.
Bear in mind that this will incurr an additional drawcall…

Should look awesome once I apply a ‘cubemap’ (UE have even included the blueprint in the documentation!). Thanks again!

I don’t think that’s a great idea, because if the same material is mapped on the entire weapon, the entire weapon will be rendered in the transparency pass.

Instead, create two materials, one for the opaque bit, and one for the non-opaque bit (glass.)

While you could still use a single texture map for opacity and one for transparency with the glass being a small slice of the UV space of the gun, that would be very wasteful for the transparency map, as it’s not needed for all of the opaque parts.
Instead, I would use a separate UV map and separate texture for the glass part. This also lets you add a distortion/refraction map for the glass, if you don’t want it to be perfectly flat.

Separately, you will have to do some fixing-up of the material once imported into the engine; there’s no getting around that. But if you break the two parts into two separate materials, with separate texture maps, that’ll make the fixing-up easier.

What size map would you recommend for the glass?