Jump to content

  • Log In with Google      Sign In   
  • Create Account


is a 16 bit normal map overkill for a 16 bit heightmap?


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
7 replies to this topic

#1 Wilhelm van Huyssteen   Members   -  Reputation: 892

Like
0Likes
Like

Posted 02 July 2012 - 05:33 AM

Hi.

Im creating a heightmap from a 16 bit channel in a texture that came from a 16 bit per channel png image using the vertex shader. I was thinking that instead of using a seperate texture for the normal map I might as well put both the normal and height map in a single 16 bit per channel (64 bbp) png image. RGB would become the normal map and Alpha would be the height map. This would also greatly simplify the process of creating height and normal maps in photoshop using the nifty normal map plugin from nvidia. Using this way I also bind one less texture but I dont know how much of an advantage that is. I dont know if the end result will have any noticeble quality improvement.

Is this aproach fine or should i rather save the normal map in a seperate 8 bits per channel image.

Sponsor:

#2 PaloDeQueso   Members   -  Reputation: 283

Like
0Likes
Like

Posted 02 July 2012 - 11:27 AM

Well, it depends on what kind of system configurations you want to support. Do your research and make sure that it's supported on devices that you are targeting. Also, make sure that it is giving you adequate performance for your application. Besides that it's up to you! I encourage you to do the research and try it out. That's half the fun! If you are using opengl or directx, there are definitely performance measurement tools. I will say that in a deferred pipeline it's not uncommon to have 32bits per channel to store gbuffer data, so why not store high resolution normals, I do, it works out pretty great!
Douglas Eugene Reisinger II
Projects/Profile Site

#3 Wilhelm van Huyssteen   Members   -  Reputation: 892

Like
0Likes
Like

Posted 03 July 2012 - 01:58 AM

Thank you for your insight.

Edited by Wilhelm van Huyssteen, 03 July 2012 - 02:00 AM.


#4 Hodgman   Moderators   -  Reputation: 26981

Like
0Likes
Like

Posted 03 July 2012 - 03:09 AM

48-bit normals (and 32-bit g-buffer channels) sounds like overkill to me. 24-bit normals work fine, and 16-bit normals work in a lot of situations.

If you were really space concious, you could use an 8bit*4channel format and pack the normals into the R&G channels, and the height into the B&A channels.

If you've got a 2048^2 heightmap, that's 32MiB if using 4x16-bit channels. Dropping down to 8-bit channels saves you 16MiB, which may or may not be a lot of RAM depending on your target hardware.

Edited by Hodgman, 03 July 2012 - 03:19 AM.


#5 chronozphere   Members   -  Reputation: 142

Like
0Likes
Like

Posted 04 July 2012 - 05:26 AM

If you feel like optimizing, you could also store the normal using spherical coordinates (in R and G) and still have B left for other purposes. That would allow you to squeeze your image into an RGB format, saving 16bits per pixel.

#6 Wilhelm van Huyssteen   Members   -  Reputation: 892

Like
0Likes
Like

Posted 04 July 2012 - 05:56 AM

I like the idea of packing the normal into R and G and then using the B and A for the 16 bit heightmap. Just one concern. Im not sure what calculations im going to have to do in my vertex shader if im using spherical coords for normals but wont it maybe be too slow? Il read up on how to do it I was just wondering what the performance impact is.

Alternitively cant i just store the normal in 15 bits using 5 bits for each axis and let one bit go to waiste? or is that a bad idea.

Edited by Wilhelm van Huyssteen, 04 July 2012 - 06:18 AM.


#7 Hodgman   Moderators   -  Reputation: 26981

Like
1Likes
Like

Posted 04 July 2012 - 06:07 AM

Check the link I posted earlier Posted Image They show that the quality result is very good, but there's quite a few ALU ops required in the decoding. However, seeing as your vertex shader is performing texture fetches, then you're going to get a certain amount of ALU ops "for free" anyway to cover that fetch latency.

Edited by Hodgman, 04 July 2012 - 06:11 AM.


#8 Wilhelm van Huyssteen   Members   -  Reputation: 892

Like
0Likes
Like

Posted 04 July 2012 - 06:26 AM

OK Il go with that. But just one last thing. I was stil editing my previous response when you replied Posted Image

cant i just store the normal in 15 bits using 5 bits for each axis and let one bit go to waiste? how would that compare to sperical normals

EDIT: this is probely a pretty stupid idea :D.


Im going to go with the spherical normals idea wich seems perfect for my needs. Thnx a lot!


Edited by Wilhelm van Huyssteen, 04 July 2012 - 06:32 AM.





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