Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 Mar 2012
Offline Last Active Today, 08:19 AM

Posts I've Made

In Topic: Execute shader depending on what's visible on screen

04 July 2014 - 06:30 AM

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.

In Topic: Execute shader depending on what's visible on screen

03 July 2014 - 03:05 PM

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?

In Topic: Execute shader depending on what's visible on screen

02 July 2014 - 06:36 AM

What about "creating" triangles with two points on your box thingy (two corners at a time) and the third on your camera world pos, then using simple trig to find the angle at the camera point. Then compare that angle to your FoV? Won't tell you exactly how many pixels are on screen, but might let you estimate on a level that is good enough?


Thanks for the idea. It's actually one of the most fitting suggestions so far rolleyes.gif


I was already doing something similar, but not using triangles with two box corners. Instead I just calculated the camera view angle to one single box corner. It's kind of working but as you say only a very rough approximation approach. I came here under the impression that there might exist a better way to do this...


Btw, what would be the benefit of using triangles. And no, the box is not axis aligned.

In Topic: Execute shader depending on what's visible on screen

02 July 2014 - 04:50 AM

Its view space position (A16R16G16B16F), you do not modify gbuffer you can transform your point in view space and compare z to see if it is visible, but i am not sure exactly what you want to do so let someone else propose some solutions.


Thanks. I am well familiar with the options of checking in screen or view or world space as I am already doing such in other places but in this case I need to do the distinction on the CPU side (in the host application that I cannot modify or extend, only "mod" with LUA scripts) that why those 3D calculations won't help.

In Topic: Execute shader depending on what's visible on screen

02 July 2014 - 04:00 AM

Oh, sorry. I might have misunderstood the question.


So yes in my post-process pixel shader I can access:


- color

- normal

- position (not sure what space, I'd guess view space)


but: how would that help in any way when I don't have any means to fill or alter that gbuffer data on the application host side where I need to do the distinction?