Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Chimera 3D

Member Since 12 Jan 2011
Offline Last Active Mar 24 2015 01:23 AM

Posts I've Made

In Topic: Emulated Double Precision Subtraction & Division

22 March 2015 - 07:13 PM


return dAdd(doubleA, vec2(-doubleB.x, doubleB.y);

 

Oh, yeah that is really simple, but why wouldn't the low part of doubleB also be negative?


In Topic: Atmospheric Scattering Errors

14 January 2015 - 02:49 PM

Since you're dividing muStart by startAlt and if the error only occurs when

 

muStart^2 - 1 < 0

muStart^2 < 1

muStart < 1

 

so maybe the problem is that startAlt is too large?

Also, in the square root function issue, what if you take the absolute value first? So it never receives a negative number.

 

Well I made the shader output muStart^2 (not at my computer atm so no screenshots) and it demonstrated similar behavior to the first image in the OP as muStart^2 starts out as white (near 1 or 1) towards the center of the planet and approaches 0 (black) towards the top atmosphere boundary then begins to approach 1 again from Rt out into space and after a certain distance (I'm guessing the startAlt), from either the center of the planet or the top atmosphere boundary, abruptly cuts off. So I'm pretty sure that's the ultimate cause of the repeating problem, still not sure why this isn't a problem in the original implementation as the computation of muStart and pretty much everything else is the same.


In Topic: Atmospheric Scattering Errors

13 January 2015 - 03:45 PM

After finally getting around to fixing the errors I tried adding this bit of code to check if the "surfacePos" was not above the top atmosphere boundary when doing the multiple scattering and it removed the secondary error described above.

  if(r0 < Rt){
	inscatter = max(inscatter - attenuation.rgbr * Texture4D(_Inscatter, r0, mu0, muS0, nu), 0.0);
  }

I updated the code in the OP to reflect this change. As it turns out the atmosphere repeating error is not related to the other error shown in the last two screenshots, I haven't figured out exactly what's causing that yet. However if in the line:

float din = -startAlt * muStart - sqrt(startAlt * startAlt * (muStart * muStart - 1.0) + Rt * Rt);

I check if the input of the sqrt function is negative and if it is output a really large number it seems to fix the first problem.

 

Screenshot19.png

 

But technically this isn't supposed to be necessary so I'm trying to figure why

startAlt * startAlt * (muStart * muStart - 1.0) + Rt * Rt < 0 if startAlt > Rt

and if muStart (assuming that this is the only value that could be negative if startAlt > Rt) being negative causes the repeat error.

 

After implementing the fix and sort-of-fix above I discovered some artifacts that seem to appear when viewing the atmosphere at a grazing angle (when the view direction [camera to surfacePos] is nearly perpendicular to the sun direction). Screens below. 

 

Screenshot18.pngScreenshot20.png

 

Anybody know what could be causing this? Anyhow I'll post my final code once I get everything else resolved.

 

EDIT: Quickly realized that muStart being negative or positive doesn't matter so I guess only if muStart^2 -1 < 0 then that produces the error.


In Topic: Anybody got some ideas on how to do this?

10 March 2011 - 10:22 PM

Actually the game is focused on one planet, and space to surface gameplay is only required for two planets. It is also a first person shooter, but the player has the ability to drive vehicles and space ships. The player would also not be able to leave a set distance from the planet. Also the player would be engaged in battle most of the time, so they would't really be roaming around board out of their mind. The only reasons for "other planets" looking realistic is because the main planet has two moons and something happens during the game where another planet teleports within orbital distance from the planet. ( I am very aware od the distance between planets in a solar system ).The game is also mission/ level based. Anyways, thanks for the information on Frontier Elite 2. I'm also glad to hear that, that wouldn't be very hard to do. Thanks. By the way "I hate declaring variables was just a little joke. My hands are now tired from typing on this iPhone!

In Topic: Real drugs - which to include in game

26 February 2011 - 10:51 PM

Posted Image

PARTNERS