Execute shader depending on what's visible on screen

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

Don't occlusion queries give you exactly what you're looking for? You might need to retool a bit in order for them to fit your game code, but issuing a query will actually tell you how many pixels are affected.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Advertisement

Don't occlusion queries give you exactly what you're looking for? You might need to retool a bit in order for them to fit your game code, but issuing a query will actually tell you how many pixels are affected.

I second this approach - it sounds like an exact match for what you are trying to do, and there is support for it built into the API itself. You can even do asynchronous queries too.

From his posting history, I think he's making a graphical mod for STALKER, which means doing raw D3D stuff is out of the picture.

What kind of rendering operations can you perform, Meltac?


From his posting history, I think he's making a graphical mod for STALKER, which means doing raw D3D stuff is out of the picture.

That is true. I stopped mentioning the X-Ray engine that STALKER uses as most people here won't post *any* replies otherwise because they don't know that engine.


What kind of rendering operations can you perform, Meltac?

As the version of X-Ray I'm working with is not open, I have only access to those parts of the engine that are, this is, a LUA based scripting sub-engine and the pure HLSL vertex and pixel shaders. No applicable DirectX host application here. So, any D3D... function calls and the like are absolutely out of scope. Probably I shouldn't have tagged this thread D3D9, but I wanted to make clear that the engine is basically built onto DirectX 9.

This said, they are virtually no "rendering" operations in the usual way possible at all. All I've got are the mentioned camera properties and the world space coordinates of the box to check against. The operations I can do must be pure math / programming algorithms without any dependency to the DirectX API or any GPU specifics.

The LUA script part provides extensions for matrix / vector math operations, though. Theoretically this should be sufficient to do the job when applied to the given point and direction coordinates and the FOV angle taken into account.

EDIT:
And to highlight it once again, I do not have *any* view / world / transformation / projection / inverse or whatever matrix available, only the point coordinates of the camera and the box.

That's what I've meant. As soon as Hodgman has mentioned STALKER and raw D3D stuff being out of the picture, no soul seems to dare to reply unsure.png

That's what I've meant. As soon as Hodgman has mentioned STALKER and raw D3D stuff being out of the picture, no soul seems to dare to reply unsure.png

I don't have any problem with the STALKER engine - I just don't know how to implement what you are asking without access to the API... Is it really necessary to use the STALKER engine, or could you upgrade to something more open?


I don't have any problem with the STALKER engine - I just don't know how to implement what you are asking without access to the API... Is it really necessary to use the STALKER engine, or could you upgrade to something more open?

I am developing mods for STALKER which are supposed to run on a normal installation of that game, so "upgrading" to whatever different engine is not an option.

I am pretty, pretty sure that the task I'm asking for is very well doable without directX API, probably even in multiple different ways. Probably I should have asked in a more math related forum rather than here, as what I am intending to do really doesn't require any D3D stuff because it's mainly a question of vector math (even though it might be well doable using the directX API as well).

As well as the math angle, it might help to describe the problem from a design perspective too. Is this something to do with radiation or anomaly zones? You want the players screen to undergo an effect when they stare into an anomaly, etc?

Also, as well as post-processing shaders, can you place custom meshes into the world and put custom materials/shaders on them? Maybe there's a solution down this path as well?

it might help to describe the problem from a design perspective too. Is this something to do with radiation or anomaly zones? You want the players screen to undergo an effect when they stare into an anomaly, etc?

Also, as well as post-processing shaders, can you place custom meshes into the world and put custom materials/shaders on them? Maybe there's a solution down this path as well?

I have made several post-processing effects that affect only certain areas on the game level map while leaving others untouched. One prominent example would be reflective surfaces, say the tile floor in some lab casting diffuse light reflections. The reflection stuff is made by a post-process shader. Implementation details of that post-process are off-topic here.

As I have no means to control which areas on the map have a reflective floor by material or color or any other 2D or 3D property I need to manually define arrays of coordinate set for those areas where the post-process should be executed. Then, my CPU-side script should check whether what the player currently sees is "mostly" part of such a defined coordinate set (e.g. tile floor to be rendered reflective), and if so, set some engine variable that will be read by the GPU-side shader to enable the according post-process. It's no an exact match then because the percentage of screen coverage will decide whether to enable a specific shader effect, but it's a approximative approach.


it might help to describe the problem from a design perspective too. Is this something to do with radiation or anomaly zones? You want the players screen to undergo an effect when they stare into an anomaly, etc?

Also, as well as post-processing shaders, can you place custom meshes into the world and put custom materials/shaders on them? Maybe there's a solution down this path as well?

I have made several post-processing effects that affect only certain areas on the game level map while leaving others untouched. One prominent example would be reflective surfaces, say the tile floor in some lab casting diffuse light reflections. The reflection stuff is made by a post-process shader. Implementation details of that post-process are off-topic here.

As I have no means to control which areas on the map have a reflective floor by material or color or any other 2D or 3D property I need to manually define arrays of coordinate set for those areas where the post-process should be executed. Then, my CPU-side script should check whether what the player currently sees is "mostly" part of such a defined coordinate set (e.g. tile floor to be rendered reflective), and if so, set some engine variable that will be read by the GPU-side shader to enable the according post-process. It's no an exact match then because the percentage of screen coverage will decide whether to enable a specific shader effect, but it's a approximative approach.

Do you have access for any gbuffer data?

This topic is closed to new replies.

Advertisement