Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


CryEngine GBuffer Normal storing technique


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 cubrman   Members   -  Reputation: 119

Like
0Likes
Like

Posted 03 July 2013 - 02:37 AM

Hi!

 

I am creating an engine on XNA 4.0 that utilizes deferred shading technique. My GBuffer is 4 R8G8B8A8 textures for Albedo, Depth, Normals and Lights, where Normals were stored like R - N.x, G - N.y, B - N.z. I was dissatisfied with the quality of my specular highlights, especially when I saw how they look when normals are stored with 16 bit precision so I started searching for other techniques. Right now I settled on CryEngine2 technique of Spheremap Transforms that stores only N.x and N.y and reconstructs N.z. Here is the link to the PPt file:

http://www.crytek.com/sites/default/files/A_bit_more_deferred_-_CryEngine3.ppt

 

I did it just like the slide #13 suggests and everything looks awesome, though a little different from the original approach, but I am in doubt whether I did it correctly. The problem is, their formula of normals deconstruction has this part: "N.z = length2(G.xy)" and I don't know what length2 means. I simply used "length(G.xy)" there and gave the formula a float2 vector (G.xy), just like in the slide. Is that correct? I also tried "length (G.x - G.y)" and it gives a totally different result.

 

Would be grateful for any advise/link.

Thanks!



Sponsor:

#2 TiagoCosta   Crossbones+   -  Reputation: 2435

Like
2Likes
Like

Posted 03 July 2013 - 02:50 AM

There's an implementation in this article. I haven't tried it myself but seems to produce good results.



#3 BornToCode   Members   -  Reputation: 948

Like
0Likes
Like

Posted 03 July 2013 - 12:16 PM

You know the length has to be one. So solving for z it should be sqrt(1-x^2-y^2) where x is G.x and y is G.y. So in that case your N.z should N.z=sqrt(1-(G.x*G.x)-(G.y*G.y)).


Edited by BornToCode, 03 July 2013 - 12:26 PM.


#4 cubrman   Members   -  Reputation: 119

Like
0Likes
Like

Posted 09 July 2013 - 01:58 AM

Ok the code in the article is either wrong or improperly explained. Firstly it seems to constantly compute imaginary square roots, which leads to errors, but when I solved it with abs() the ligts it produces are absolutely stupid.

The BornToCode's advise (sqrt(1-(G.x*G.x)-(G.y*G.y))) also led to wrong results. The author seems to have mistaken the Guerilla's approach to normal packing with CryTech's one.



#5 cubrman   Members   -  Reputation: 119

Like
0Likes
Like

Posted 10 July 2013 - 03:21 AM

I ended up using normal packing technique from Crysis 3. Thankfully they explained it quite well in their presentation.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS