Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScatterSky Flare Rendering - Occlusion Is Broken #764

Closed
C-Hall opened this issue Aug 28, 2014 · 4 comments
Closed

ScatterSky Flare Rendering - Occlusion Is Broken #764

C-Hall opened this issue Aug 28, 2014 · 4 comments
Assignees
Labels
Milestone

Comments

@C-Hall
Copy link

@C-Hall C-Hall commented Aug 28, 2014

When a ScatterySky object is used with a Flare enabled it will not render if the LightFlareData datablock defines an 'occlusionRadius' value. This problem appears to be specific to the ScatterSky and does not seem to occur in Sun objects or lights. I'm unsure if this issue is specific to certain graphics cards similar to an earlier problem involving reflections: #747

My original post about the issue can be found here: http://www.garagegames.com/community/forums/viewthread/138892 To sum-up the info from the post:

In scatterSky.cpp in the prepRenderImage function the flare data is setup with a position.

Point3F lightPos = state->getCameraPosition() - state->getFarPlane() * mLight->getDirection() * 0.9f;  
mFlareState.lightMat.identity();  
mFlareState.lightMat.setPosition( lightPos );

Just like in the Sun object's flare code the flare is then sent to LightFlareData::prepRender. Except, unlike the Sun object's flare the ScatterSky flare exits the function here:

bool lightVisible = _testVisibility( state, flareState, &visDelta, &occlusionFade, &lightPosSS );  

// We can only skip rendering if the light is not   
// visible, and it has elapsed the fade out time.  
if (  mIsZero( occlusionFade ) ||  
      !lightVisible && visDelta > FadeOutTime )  
   return; 

_testVisibility will return false and the render will be skipped. By removing 'occlusionRadius' from the LightFlareData datablocks the issue seems fixed. Notably, LightFlareExample2 and SunPacificIsland do not have those values defined in script and therefore work fine without any changes.

My guess is that somehow the sky itself is blocking visibility of the flare position.

Here are links to the code I referenced:

https://github.com/GarageGames/Torque3D/blob/development/Engine/source/environment/scatterSky.cpp#L657
https://github.com/GarageGames/Torque3D/blob/development/Engine/source/T3D/lightFlareData.cpp#L447-L453

@crabmusket
Copy link
Contributor

@crabmusket crabmusket commented Aug 28, 2014

Thanks for the detailed report! I think Felix Westin ran into some similar issues. Have a search of the forums. He and deepscratch, I think, were looking at stuff. Though it was possibly due to other occluding objects.

@crabmusket crabmusket added this to the 3.7 milestone Aug 28, 2014
@crabmusket crabmusket removed this from the 3.7 milestone Oct 15, 2014
@crabmusket crabmusket added this to the 3.6.2 milestone Oct 15, 2014
@crabmusket crabmusket added this to the 3.6.2 milestone Oct 15, 2014
@crabmusket crabmusket removed this from the 3.7 milestone Oct 15, 2014
@crabmusket
Copy link
Contributor

@crabmusket crabmusket commented Oct 19, 2014

Research here and here. @LuisAntonRebollo is this something you've fixed in BeamNG that we could crib code from?

@LuisAntonRebollo LuisAntonRebollo self-assigned this Oct 25, 2014
@LuisAntonRebollo
Copy link
Contributor

@LuisAntonRebollo LuisAntonRebollo commented Oct 25, 2014

I can handle this.

@crabmusket crabmusket removed this from the 3.6.2 milestone Nov 3, 2014
@crabmusket crabmusket added this to the 3.6.3 milestone Nov 3, 2014
@crabmusket crabmusket added this to the 3.6.3 milestone Nov 3, 2014
@crabmusket crabmusket removed this from the 3.6.2 milestone Nov 3, 2014
@LuisAntonRebollo
Copy link
Contributor

@LuisAntonRebollo LuisAntonRebollo commented Dec 19, 2014

Fixed on #1024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants