Jump to content
  • Advertisement
Sign in to follow this  
genesys

shaders with transparency

This topic is 4728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I've got a Problem! I just started coding HLSL shaders with Rendermonkey. Now i'm trying to create billboards with transparent parts . . . but i don't get transparency to work! Can someone explain me how to achieve that plz? THX!

Share this post


Link to post
Share on other sites
Advertisement
I've never tried this but I did notice that many shader variables have a 4th parameter for alpha... RGBAlpha

I'm talking about the nvidia fx files. don't know about ATI.

Share this post


Link to post
Share on other sites
What do you have so far? What does it do? It is a bit of a long shot to start talking from scratch.

Here's a basic introduction into the principles of transparency.

Greetz,

Illco

Share this post


Link to post
Share on other sites
Hum . . . i'm creating directX shaders with rendermonkey . . . now i've got it after copy pasting the Render State node of one of the example scenes into my renderpass (before i tried to make a render state from scratch and changed all the parameters so that they were the same like in the example scene - but that didn't work)

The problem is, that i don't really understand what those render states are. Why can't i define transparency in the shader itself??

I won't use FX files because my gameengine doesn't support it . . . I just use the created HLSL code - but if the transparency is defined in the render state, i can't take it into my gameengine . . . *confused*

Share this post


Link to post
Share on other sites
You can output a specific alpha/transperency value for a certain pixel in your pixel shader. That's what you can do from HLSL.

But it is the framebuffer blending component that decides what to do with the output - and that's a fixed function component that is setup and controlled by the render states. To do basic blending you should:

1) Turn on blending:
device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);

2) Set the src and dst blend factors
device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

- Kasper

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
if you want transparency then you have to assign a value <

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
if you want transparency then you have to assign a value <

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
somehow the forum has cut away a part of my post :(

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!