glsl access viewport pixels

Discussions regarding Materials, Material-Compounds or Shaders, etc.
Dan Lane
Posts: 2
Joined: 15 Feb 2012, 09:41

glsl access viewport pixels

Post by Dan Lane » 08 Oct 2012, 12:43

Hi,

I'm really new to glsl shaders and not really sure what is or not possible.

I have tried to simulate a realtime contour type shader by looking at the normals of a model. which works properly but the effect still isn't what I'm after. looking on the net I found that some people do an edge detection type process, so i'm thinking for me to do this I need to somehow access the pixels of the viewport maybe after a first pass glsl shader then a second glsl shader would access the result of that to do the edge detection.

Is this even possible? Are there any examples on the net that show something like this?
Or can someone suggest a better approach?

Hope that lot made some sense!
Thanks for reading

Dan

BenR
Posts: 92
Joined: 11 Jun 2009, 18:52

Re: glsl access viewport pixels

Post by BenR » 08 Oct 2012, 16:11

Dan Lane wrote:Hi,

I'm really new to glsl shaders and not really sure what is or not possible.

I have tried to simulate a realtime contour type shader by looking at the normals of a model. which works properly but the effect still isn't what I'm after. looking on the net I found that some people do an edge detection type process, so i'm thinking for me to do this I need to somehow access the pixels of the viewport maybe after a first pass glsl shader then a second glsl shader would access the result of that to do the edge detection.

Is this even possible? Are there any examples on the net that show something like this?
Or can someone suggest a better approach?

Hope that lot made some sense!
Thanks for reading

Dan

Well I don't know if you can do it just within the shader tree. It would be possible with a custom XGS (graphic sequencer) realtime shader. You could write the viewport to an FBO and then look up the values for your edge detection algorithm.

Ben

User avatar
Kerro Perro
Posts: 306
Joined: 20 Mar 2011, 00:01
Location: Leiden, the Netherlands

Re: glsl access viewport pixels

Post by Kerro Perro » 08 Oct 2012, 21:44

Hi Dan, I'm sorry i can't help you - your post is the first i've even heard of these shaders - but can you please keep me/us abreast of any progress you make on this? I am very interested in the concept of a real time "line shader" inside softimage! :ymdaydream:

Dan Lane
Posts: 2
Joined: 15 Feb 2012, 09:41

Re: glsl access viewport pixels

Post by Dan Lane » 09 Oct 2012, 10:35

Hi, Thanks both for the replys, I'll look into the custom XGS, and I'll be sure to share my progress(or lack of it!) on this thread.

Thanks

Dan

BenR
Posts: 92
Joined: 11 Jun 2009, 18:52

Re: glsl access viewport pixels

Post by BenR » 09 Oct 2012, 16:32

Dan Lane wrote:Hi, Thanks both for the replys, I'll look into the custom XGS, and I'll be sure to share my progress(or lack of it!) on this thread.

Thanks

Dan
I think it should work. That's how I wrote my anaglyph viewport addon, by writing both cameras to FBO's and then combining them with a glsl shader.