Jump to content
Sign in to follow this  
haleks

Create an invisible rvmat

Recommended Posts

Guys, I could use some help...

 

I'm stumbling on a feature for my Remnant mod : to make it short, Phantom units visibility has to be handled client-side exclusively. Depending on the settings set by the mission maker, only players using NVGs, thermal vision and/or standing still can see Phantoms; but, at the same time, players unable to see phantoms must remain able to wound them.

 

Now the obvious choice would to use hideObject locally, but since that command disables collisions and hits, that's a no-go. The only solution I can see, and one that works locally, is to play around with setObjectTexture and setObjectMaterial. Here's the problem : while it's possible to remove textures with 'this setObjectTexture [0,""]', the same trick doesn't work with setObjectMaterial... When I try to apply an empty rvmat to a phantom, the unit shows the original model rvmat (in this case the VR entity material). I looked in the game data for "invisible" rvmats, and found 2 of them : UniversalOnSurface and Refract (both in a3/data_f).

ambient[] = {1, 1, 1, 1};
diffuse[] = {1, 1, 1, 1};
forcedDiffuse[] = {0, 0, 0, 0};
emmisive[] = {0, 0, 0, 1};
specular[] = {1, 1, 1, 1};
specularPower = 1000;
PixelShaderID = "Sprite";
VertexShaderID = "SpriteOnSurface";
ambient[] = {1, 1, 1, 1};
diffuse[] = {1, 1, 1, 1};
forcedDiffuse[] = {0, 0, 0, 0};
emmisive[] = {0, 0, 0, 1};
specular[] = {1, 1, 1, 1};
specularPower = 1000;
PixelShaderID = "SpriteRefract";
VertexShaderID = "Sprite";

Applying one of those on phantoms works great - they are completely invisible, but those rvmats cause a weird visual artefact, like a black square located at some distance ahead of the unit's 3d model...

Which brings me to my question, how would you configure a totally transparent material? One that doesn't create visual oddities. cafe2.gif

Share this post


Link to post
Share on other sites

Could you not simply apply an 'empty' rvmat (or no rvmat at all as you did with the texture)?

Share this post


Link to post
Share on other sites
16 hours ago, Jackal326 said:

Could you not simply apply an 'empty' rvmat (or no rvmat at all as you did with the texture)?

 

Sadly, no. As I mentioned, trying to do so will remove any rvmat applied with setObjectMaterial, but the material linked to the 3d model itself remains visible. :/ 

Share this post


Link to post
Share on other sites
9 hours ago, haleks said:

 

Sadly, no. As I mentioned, trying to do so will remove any rvmat applied with setObjectMaterial, but the material linked to the 3d model itself remains visible. 😕

My bad, I completely missed that paragraph of your post 🤦‍♂️

My only other suggestion would be to perhaps play around with other PixelShaderID and/or VertexShaderID values.

Perhaps:

PixelShaderID="AlphaShadow"; // or "Alpha" if thats even a valid entry...
VertexShaderID="Basic";

 

Share this post


Link to post
Share on other sites

Fixed it...

I was generating files from a mission folder while the game was running, and realised that each new iteration needed a unique name in order to be properly loaded... facepalm.png

 

Anyway, I just added a bunch of flags to the refract.rvmat, and voilà!

renderFlags[]={"NoAlphaWrite", "NoColorWrite", "NoTiWrite","NoReceiveShadow","NoZWrite"};

 

Share this post


Link to post
Share on other sites
6 hours ago, haleks said:

Anyway, I just added a bunch of flags to the refract.rvmat, and voilà!


renderFlags[]={"NoAlphaWrite", "NoColorWrite", "NoTiWrite","NoReceiveShadow","NoZWrite"};

 

 

Ahh yes, that was going to be my next suggestion 🧐

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×