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!


Member Since 21 Nov 2005
Offline Last Active Apr 24 2015 06:10 AM

Posts I've Made

In Topic: Keeping camera inside map bounds

25 July 2014 - 02:57 PM

Create a bounding box smaller than the level, and constrain the camera to never move outside of that?



The camera is defined by two things, position and view direction.

Constraining the position to a box is trivial, sure, but the problem is constraining the view direction so the limits of the map are never visible.


My camera view direction vector can have any value except having the Y component pointing up (to the sky).

So I'm interested in knowing what kind of math could be used in this case.

In Topic: Color grading shader

08 June 2014 - 11:43 AM

Ah yes, I overlooked that part about precise coordinatse.


If you use nearest neighbor interpolation, you effectively reduce your amount of colors to 16*16*16 = 4096. I.e. a kind of posterize effect.


Yes true, but I'm not just looking up one single color at nearest, I'm interpolating between two colors, so I think I get much more than that.

I've got this shader running in my game, I applied it to everything from GUIs to scene drawing and did not notice any color loss, especialy nothing similiar to a posterize effect.


However as Hodgman said, I understand now that in the 2d LUT case this manual interpolation should be done only for the blue component, as is the only one that cannot really be interpolated via texture filtering.

In Topic: Color grading shader

08 June 2014 - 07:37 AM

Thanks Hodgman, thats lots of useful information there.

However that bit about using linear vs nearest, there was reason why I did not use linear (I might be wrong though, correct me if thats the case).

This 2D texture is basically emulating a 3D texture, so we can think of it as a series of slices (arranged horizontally).

If the shader tries to lookup a color in the LUT that falls near the "slices" borders, it will interpolate between two slices, and that will produce very wrong results (eg: mixing very light colors with dark colors).

What solution you can think to avoid this problem when using linear filtering?


But the problem why I created the topic is that in my laptop, the results are completly wrong for some of the pixels (eg: some pixels appeared magenta when they should appear dark blue). In all other devices, from PCs running Windows, OSX and lots of mobile devices, the results at least it looks good to the eyes (might be not exactly correct if we compare the exact in and out RGB values, as you said, this shader is missing some details.

However as I said in my previous post, this particular issue was fixed just by disable Catalyst AI option (this laptop has a ATI card, around 4 years old).

Might be old drivers, or just the way the "catalyst AI" setting works, I'm not sure, but it somehow was altering the texture pixels/quality/size.

In Topic: Color grading shader

08 June 2014 - 03:39 AM

Hi, thanks, did not know about textureFetch(), however it does not existe in GL ES 2.0.

By the way, I found the problem, and it was really stupid...


Disabling ATI Catalyst AI setting fixes it!

I guess this setting was making the texture into a 16 bit texture instead of 32 bit or something else really funky that did mess with the results...

Anyone has a clue what could cause it, and if there is a way to hint the drivers to not mess with the textures?

In Topic: Next step, making a company?

29 May 2014 - 11:56 AM

Thanks Andy, that seems a good point, something that I need to investigate, maybe be similar to US, or different, I really need to check!