Interior Mapping demo

Discussion in 'Rendering Technology and APIs' started by Humus, Aug 3, 2008.

  1. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    I've published a new demo showing off the Interior Mapping technique, which basically is a pixel shader based technique for adding interiors to buildings. The buildings are still rendered as simple boxes. Rooms are represented as a cubemap and I'm using cubemap arrays in DX10.1 to select between different room layouts to avoid repeativeness.

    [​IMG]

    I was going to say "download at the usual place", but hey, it's not at the usual place, because my site has moved. ;)
    It's now at www.humus.name, but is otherwise the same site as before.
     
  2. CarstenS

    Veteran Subscriber

    Joined:
    May 31, 2002
    Messages:
    4,756
    Likes Received:
    1,992
    Location:
    Germany
    So, 10.1-CM-arrays means no-go for Geforce-user? ;)

    But judging from the screenshot it looks like it could make large downtown sceneries much more believable. Any ideas if there are games going to be using it?
     
  3. fellix

    fellix Hey, You!
    Veteran

    Joined:
    Dec 4, 2004
    Messages:
    3,446
    Likes Received:
    327
    Location:
    Varna, Bulgaria
    What would be the performance hit rendering those cube-maps in DX10.0?

    For the report - it runs flawlessly for me (4870), just had to update the DX with June's Redistributable.
     
  4. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    Yeah.

    Haven't heard of any.

    I'm not rendering to any cubemaps. The cubemaps are static. It's just the room walls, floor and ceiling stored in the faces of the cubemap. The option for DX10.0 would be to rotate the walls for the same room. That would give you 4 out of the 8 permutations I have now, but be more expensive, a bunch of ALU instructions extra. Should look good enough though.

    Best would be if you had enough artwork for several different room types. If I had more time or were better at Photoshop I would have done that. That's not an option you have with DX10.0 though with this technique, unless you use several samplers and dynamic branching to select.
     
  5. CarstenS

    Veteran Subscriber

    Joined:
    May 31, 2002
    Messages:
    4,756
    Likes Received:
    1,992
    Location:
    Germany
    Then I'll give it a try as soon as my new Radeon arrives. But I'm having a hard time deciding between the ultra-cheap (~60 Euro) 3850 and the still-cheap but far more powerful HD4850.


    Pity. It'd be a really nice thing for GTA-something or Max Payne III ;)
     
  6. willardjuice

    willardjuice super willyjuice
    Moderator Veteran Alpha Subscriber

    Joined:
    May 14, 2005
    Messages:
    1,366
    Likes Received:
    218
    Location:
    NY
    Perhaps you should update your sig. :razz:

    I'm sure it's an awesome demo, must remember to try it when I get hardware that can run it. :sad:
     
  7. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    Done. Thanks for reminding me. :)
     
  8. NRP

    NRP
    Veteran

    Joined:
    Aug 26, 2004
    Messages:
    2,709
    Likes Received:
    289
    Nevermind
     
    #8 NRP, Aug 3, 2008
    Last edited by a moderator: Aug 4, 2008
  9. Panajev2001a

    Veteran

    Joined:
    Mar 31, 2002
    Messages:
    3,187
    Likes Received:
    8
    It is a great demo, but I feel it breaks down with rooms on the corners which have two windows... nothing on the programming side, just an artistic consideration... kinda funny imagining where the virtual diagonal wall obstructing the light is :).
    In that picture (easier to spot when you look at the large version of it in your web page) you can spot this minor issue quite a bit (second building on the right).
     
  10. Johnny_Physics

    Newcomer

    Joined:
    Sep 12, 2003
    Messages:
    205
    Likes Received:
    3
    Location:
    Norway
    Something very similar, but as fancy, was used in Crackdown on Xbox360, really nice touch and a great use of making shaders give more to the game than the more obvious effects you'd expect. Since I have a GeForce and can't run this demo I will take my revenge by posting a Crackdown-picture :D

    Couldn't find a good picture and my memory is fuzzy so that might be one of the few normal windows pictured, so my nVengeance is tepid at best, but it was most noticable at night with dimmed lights behind curtains and such...
    [​IMG]
    Link to bigger:
    http://xbox360media.ign.com/xbox360/image/article/747/747365/crackdown-20061122110819256.jpg


    Great effect though, I hope to see the more advanced type like Humus' demo in something soon, it's a clever use of available resources.
     
  11. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    True. I did consider that, but found it not to be too disturbing. Artists would probably disagree though. :p It could be fixed though. In this demo I'm using math to basically randomize it. You could use low res textures instead. For a real game that's probably what you want to do anyway to let artists tweak the look. That way you could make sure rooms align across corners and you don't get any issues with light being turned off on one side of the corner and lit on the other side.

    Yep. I really liked the idea when I heard of it. Lots of games have just plain window textures with nothing inside, or just a flat image. Getting some depth to the interiors really does improve things a lot.
     
  12. Sc4freak

    Newcomer

    Joined:
    Dec 28, 2004
    Messages:
    233
    Likes Received:
    2
    Location:
    Melbourne, Australia
    Perhaps I'm missing something, but wouldn't this require far more processing power than just having real geometry for the room? A box for a room would be an extra 8 vertices - but you need many more pixel shader instructions for interior mapping. I imagine this would only yield a performance benefit if you had a lot of buildings with many windows, and they were all very far away (so they don't cover many pixels).

    Although I guess it would save time for artists.
     
  13. Albuquerque

    Albuquerque Red-headed step child
    Veteran

    Joined:
    Jun 17, 2004
    Messages:
    3,845
    Likes Received:
    329
    Location:
    35.1415,-90.056
    Not really. With "real" geometry, think of all the Z-work involved, especially if there are lots of buildings. A big huge single box is much easier to z-test versus (potentially) many hundreds of individual rooms. And then you'll have translucency and reflection calculations with the glass on the windows versus how much of the room behind it is visible.

    The extra shader instructions are trivial compared to the rest...
     
  14. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    The shader is 15 ALU instructions on RV670 / RV770. Half of that are things you would need in the geometry case too anyway if you want the same visual quality, like the lighting. Computing the cube texture coordinate is 7 ALU. Also, using real geometry you'll have to separate it into two passes, one for the interior and then another pass blending the exterior on top of it. This is inefficient since you won't get much help from z-rejection because the interior must be rendered first.
     
  15. Oogst

    Newcomer

    Joined:
    Aug 8, 2008
    Messages:
    8
    Likes Received:
    0
    Location:
    Netherlands
    Ah, that is a pretty interesting variation to my original Interior Mapping technique! It is cool to see other people experimenting with other approaches!

    I cannot run your demo, though: I have an Nvidia DX10 card. It is a pitty that your technique requires DX10.1: this makes it much less applicable. Because my own technique runs well in shader model 2, it can be used on the XBox 360 and the Playstation 3, which is a great benefit. Your technique does seem to be a lot cheaper per pixel, though, which is nice.

    I am wondering to what extent your demo is pespectively correct, because a cubemap only takes into account ray direction and not ray origin. Can you explain how you handle that?
    I did tests comparing polygonal rooms to Interior Mapped rooms and the performance of my version of Interior Mapping is pretty good, actually. And that was with much more efficient rooms: roofs, ceilings and walls of rooms can be shared between rooms, so the actual geometry required is much less than 8 vertices per room. Still, Interior Mapping absolutely appears to be preferable above actual geometry.

    My full paper (published at Computer Graphics International 2008) with the performance comparison can be found here.
     
  16. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    It's perfectly perspective correct. I don't use the direction ray directly, instead I compute the intersection point of the ray with the room. If you start with interpolated position X I compute the intersection Y.

    Code:
    +----------------Y----+
    |               /     |
    |              /      |
    |             /       |
    |            /        |
    |           /         |
    |          /          |
    |         /           |
    |        /            |
    |       /             |
    +======X==============+
    


    The final code after my optimizations is perhaps not so intuitive at what exactly it does:

    Code:
    float2 f = frac(In.texCoord);
    
     // Entrance position into the room
    float4 pos = float4(f * float2(2.0, -2.0) - float2(1.0, -1.0), -1.0, cubeIndex);
    
    // Compute position where the ray intersects the cube
    float3 id = 1.0 / In.dir;
    float3 k = abs(id) - pos * id;
    float kMin = min(min(k.x, k.y), k.z);
    pos.xyz += kMin * In.dir;
    
    But basically I just compute the smallest interpolation factor (k) required to hit a wall in x, y or z and use that.
     
  17. Oogst

    Newcomer

    Joined:
    Aug 8, 2008
    Messages:
    8
    Likes Received:
    0
    Location:
    Netherlands
    Ah, okay, that is clear, but doesn't that make your technique hardly any more efficient than my version? What is the benefit of using a cubemap in this case?
     
  18. willardjuice

    willardjuice super willyjuice
    Moderator Veteran Alpha Subscriber

    Joined:
    May 14, 2005
    Messages:
    1,366
    Likes Received:
    218
    Location:
    NY
    I don't think Humus ever said his version is the best. He often makes demo's just to show people "hey look what's possible!" not "hey my way is the best and everyone else fails".
     
  19. Oogst

    Newcomer

    Joined:
    Aug 8, 2008
    Messages:
    8
    Likes Received:
    0
    Location:
    Netherlands
    That his technique would be better was actually my own conclusion when I did not yet understand how this technique works. :)
     
  20. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    You only need a single texture lookup. I think yours needs four.
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...