Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Optimizing and Texture Lookups  (Read 500 times)
sybixsus
Customers
Community Member
*****
Posts: 1088


WWW
« on: March 07, 2008, 02:03:37 PM »

I'm taking another look at my main environment shader which currently does normalmapping with two lightsources, dynamic shadow map and specular highlights. It uses to do more lights and also do static shadows, but to make it faster, I cut those out. I'm wondering precisely why it was slow before, particularly with the static shadows. I was doing a texture lookup on a rgb map, but now I'm wondering whether I could put my lightmap in the alpha channel of the diffuse map. Then I could grab the whole thing in one texture lookup and then just use the .rgb components for diffuse and .a for the lightmap, and combine that with the shadowmap. Granted it would no longer be a coloured lightmap, but I already have dynamic lights, so just light and shade on the lightmap would be nice.

What I'm getting at is how much slower is it to read RGBA from a texture than it is to read RGB? How much faster is it to do an RBGA lookup compared to two RGB lookups? Can I expect hiding the lightmap in the diffuse texture to give me a slight performance inprovement or a huge one?

The main reason I'm asking instead of testing is that I don't have a machine with a low end videocard available to me at the moment, and I've upgraded since the old shader. Now it's pretty hard to slow down my 8600 GTS, so it's not really going to be much of a test.
Logged
Waterman
Customers
Community Member
*****
Posts: 1141


« Reply #1 on: March 07, 2008, 03:22:56 PM »

I wonder if anyone else has benchmarked such a thing...

Imo a single lookup is much faster than two, while including another 8 bits in a lookup should have no practical impact at all.

I'll have to guess... 10-1000 times faster?
Logged

Things should be described as simply as possible - but not simpler [A. Einstein]
sybixsus
Customers
Community Member
*****
Posts: 1088


WWW
« Reply #2 on: March 07, 2008, 05:23:50 PM »

Thanks Waterman, your thoughts are very much in line with my instincts, but it's very good to hear that someone else has the same instincts as me on it.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks