Execute shader depending on what's visible on screen

Started by
33 comments, last by Meltac 9 years, 9 months ago

What is the post process effect that you are trying to limit to certain space. You could just simply make view space AABB and test if the pixel position is inside it and process that pixel and if not then just pass through.

Did you read through the thread?

There is not one single but various post process effects I'm using, one of them is (fake) light reflections on the floor. And I have to select which shader to activate in the host application which is not capable of doing any directX API / raw 3d stuff - so, nothing here to "process" or "pass through". It's a question of dealing with a set of coordinates and a handful of camera properties (world pos, view direction, FOV). Mainly a math / geometrical / trigo question.

DvDmanDT's idea is the best so far, but I'm sort of stuck on making an algorithm that works well (in terms of creating the closest possible match, as it's an approximative approach).

I mean, the box to compare the camera pos and dir against consists of 8 corner points. So if I would be able to check how many / which of those corner points are located inside the current screen boundaries, or outside of the screen - what would be the best way to check whether the inside of the box actually "fills" most of the screen?

Advertisement

Maybe I'm being stupid here, but how can you define a non-aligned box by just two points?

What is the post process effect that you are trying to limit to certain space. You could just simply make view space AABB and test if the pixel position is inside it and process that pixel and if not then just pass through.

Did you read through the thread?

There is not one single but various post process effects I'm using, one of them is (fake) light reflections on the floor. And I have to select which shader to activate in the host application which is not capable of doing any directX API / raw 3d stuff - so, nothing here to "process" or "pass through". It's a question of dealing with a set of coordinates and a handful of camera properties (world pos, view direction, FOV). Mainly a math / geometrical / trigo question.

DvDmanDT's idea is the best so far, but I'm sort of stuck on making an algorithm that works well (in terms of creating the closest possible match, as it's an approximative approach).

I mean, the box to compare the camera pos and dir against consists of 8 corner points. So if I would be able to check how many / which of those corner points are located inside the current screen boundaries, or outside of the screen - what would be the best way to check whether the inside of the box actually "fills" most of the screen?

You can easily do shader that contain multiple effects and then you just choose which one use per pixel.

I don't think that's what he wants. He seems to want all or nothing based on screen contents. Still not sure I follow on the contents though. From my understanding, the boxes aren't actually "there", as in they have no drawn geometry. You can stand inside of them, in which case the filter/effect should not be applied?


You can easily do shader that contain multiple effects and then you just choose which one use per pixel.

Believe me, in this particular case I can't. The insight reasons for this would be off-topic here. Just think of instruction limits.


I don't think that's what he wants. He seems to want all or nothing based on screen contents. Still not sure I follow on the contents though. From my understanding, the boxes aren't actually "there", as in they have no drawn geometry. You can stand inside of them, in which case the filter/effect should not be applied?

Right. The "box" is not being rendered, it's only virtual, a defined area in which something happens. No "physical" object to be drawn. The box's sole purpose is to serve as reference coordinate boundaries in which a certain effect will take place.


Maybe I'm being stupid here, but how can you define a non-aligned box by just two points?

Well, it's an approximation. Think of it being aligned if it helps.

This topic is closed to new replies.

Advertisement