Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / DIY Default shader + transparency?

Author
Message
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 9th Dec 2016 22:34
If I take the default VS and PS shaders, what would I need to do to [shader] programatically add transparency to them?
I have exported the default shaders that are in use for a transparent and non-transparent object and they are the same. The documentation says that there are variables passed to the shader in real-time and I'm guessing something is passed to the AGKDiffuse uniform to adjust opacity, but I can't find any help on this.

The only reason I want this is because I can't use the object transparency, I just want to transparent a single mesh in the object.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 12th Dec 2016 14:05
Transparency is handled after the shader, but it uses the alpha value that the shader outputs. For example if you used SetObjectTransparency with the value 0 then the object will always be opaque no matter what the shader outputs as the alpha value, but using a value of 1 would use the shader alpha value to determine the amount of transparency to apply. So in theory you could achieve this by making the shader output 1 for the alpha when you don't want it to be transparent otherwise return the normal alpha value.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 20th Dec 2016 22:40

Login to post a reply

Server time is: 2024-09-29 21:19:55
Your offset time is: 2024-09-29 21:19:55