Jump to content

SunBokeh resource problem


Duion

Recommended Posts

Recently I tried to integrate the Sun glare/screen dirt shader resource from Felix Westin from the garagegames forum:

http://www.garagegames.com/community/resource/view/22785/1


It worked quite well, but later I noticed it does not work at all in multiplayer, since it uses a datablock value to store the visibility, which is only available on the host.

Later JeffR helped me with a possible fix, it worked then in multiplayer, but it is only a simple raycast that checks if on or off, the original function did check for percentage of the sun visible, which produces a fade if objects cover the sun.


So here is my integration of the original resource:

https://github.com/Duion/Torque3D/commit/637a804fd78f84103c385b6291658babd23f561a

And here the possible fix method:

https://github.com/Duion/Torque3D/commit/5f2ab23fac60ea02f4ae3b7c24470919e0e814e2


The idea of the fix was to copy over the function from lightFlareData.cpp to postEffect.cpp so it can be used directly in that function.

This is the function needed:

https://github.com/Duion/Torque3D/blob/ueberengine-dev/Engine/source/T3D/lightFlareData.cpp#L260

That function checks with an occlusion query how much of the sun flare is visible on the screen and outputs a float value from 0 to 1, that value is the variable needed in postEffect.cpp.


Currently I have two basic ideas, either the output from the function needs to be transferred to postEffect.cpp, which is the method the original resource used and the other idea is to copy the whole function into postEffect.cpp so it can be executed directly from there.

First I liked the method JeffR suggested to me, but now I think the first method may work as well. The problem with the first method is, that in the function it tries to find the scatterSky object which needs to be called a specific name and I think that is the problem with that method, since this does not work on the client, since only the host has the objects, which then are turned into ID objects with a number and send to the client, so of course the client cannot find the object.


So any ideas how this can be solved?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...