Jump to content
The Dark Mod Forums

Rendering Real Rooms without Building


NeonsStyle

Recommended Posts

So here's a neat trick I would really like to be able to take advantage of in my Venice map. Take a look at the first part of this 

video by SimCity, then if you want to learn how it's done, check the 2nd link, where the scientist who invented the idea explains

how to do it, and links you to his paper on the top to show you how to do it. 

[forgot how to embed video in here lmao] hint please

https://youtu.be/_x88tvkAGuo?t=64

https://80.lv/articles/interior-mapping-rendering-real-rooms-without-geometry/

Here is the PDF of his Scientific Paper he wrote explaining in detail how to do this.
http://www.proun-game.com/Oogst3D/CODING/InteriorMapping/InteriorMapping.pdf

Edited by NeonsStyle
Trying to embed video
  • Like 2

I have an eclectic YouTube channel making videos on a variety of games. Come and have look here:

https://www.youtube.com/c/NeonsStyleHD

 

Dark Mod Missions: Briarwood Manor - available here or in game

http://forums.thedarkmod.com/topic/18980-fan-mission-briarwood-manor-by-neonsstyle-first-mission-6082017-update-16/

 

 

Link to comment
Share on other sites

Wow, that is a nice trick.

But imagine playing a TDM map having them. If a map has knobs on blind doors, that is a minor annoyance. But making all hundreds of windows in a map look like you could somehow enter the room behind... Good luck finding the usual two to five, wich actually have real geometry behind them.

Link to comment
Share on other sites

Something a bit like this, perhaps?

 

Translating the shader over into a proof-of-concept wasn't bad at all.  Here's what we'd have to figure out:

  • How to get this in-game.  At the moment I'm using the techniques from this thread:It's only running properly with the special build from there.  If custom shaders are going to remain a more experimental thing in 2.08, this might become something to spend some time and make well-rounded enough for general inclusion in the following release.
     
  • What is the best way to supply textures to the shader.  It would be neat if a mapper could build some rooms and take envshots of them, and use those as an input.  We could get fancy and randomize which walls to use within a room, or get even fancier and have detail layers on top of the walls.  Also have a mid-plane with alpha cut-outs for more depth...
     
  • How to set the size of the rooms.  Right now it's hard-coded, and the repeating nature works better for skyscrapers than strewn-about buildings.  You wouldn't want a wall running down the middle of your window, so we'll have to work around that.
     
  • What do to about lighting.  I'm drawing the shader itself full-bright as lights shining on its surface would ruin the effect.  That's unavoidable, the question is how to achieve lighting within the fake rooms.  The original code simulates a light within each room (which I didn't port over), but I'm leaning towards keeping it simple and relying on the envshots having pre-baked lighting in them.  I haven't thought through the implications either way when it comes to normal/specular maps.
     
  • How to put a window in front of this.  Should we leave it as-is and rely on the mapper to put a transparent material in front with their desired effect?  I'm leaning towards that in order to keep things flexible, but I haven't tried it yet.
     

I'm fairly busy the rest of the week but I think this is really cool and plan to keep working on it.  I'd welcome any input from others with more experience.

 

  • Like 3
Link to comment
Share on other sites

This is great! 😍

 

I guess you could say that interior mapping is a cubemap convolution technique that scales better than doing

convolutions individually. It is novel largely because most real-world cubemap usage is for faked reflections

so even if engines like Doom 3 can cubemaps that look like interiors, that was never the intended use case.

 

The thing I've always wanted was a way to automate cubemap collection near func_portals so that you could

paint an interior map on a func_portal leading to a rectangular passage such as a side street or hallway. This

would allow you to keep that func_portal closed far longer than the flat billboard images typically used on func_portals.

 

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

1 hour ago, duzenko said:

Hey, isn't that just a cubemap texture?

From a player's perspective, the difference is that a cubemap moves with you whereas this is fixed in place.

I fixed it up to work in the 2.08 beta and I'm putting together a better demo now.  I'll upload it shortly...

  • Like 1
Link to comment
Share on other sites

I made a few tweaks and fixes, here's a better demo of what this does:

 

I've also got the map for download if anyone wants to play with it (probably 2.08 beta only!):

https://drive.google.com/file/d/1jrlVFd6AerWYHdBxyJJjVVPe0Q1sodY5/view

To load it from the console, the map name is "im".

I also left the room where I took the envshot in the map.  It's a bit tricky to line it up right yourself, to take one you can move the playerstart on top of the nodraw pedestal in the room.  The light in the room has specular turned off, since that's based on your position it will look incorrect otherwise.

 

@duzenko I've found a really weird issue, if you look at my material file you'll notice I have two materials: textures/interior_map and textures/interior_map_wtf_green.  If you replace the regular one with the wtf_green one, the texture in fragmentMap 1 takes on a greenish tint.  My workaround was to put a texture I don't use into that slot and move the one I wanted to slot 5 instead. If you do a diff on the shaders you'll see that's the only change.  If you put the same texture into 1 and 5, both turn greenish so I think whatever goes into that slot gets corrupted somehow.  And even if you use the same texture on a totally different material it still goes green!

 

Edited by HeresJonny
Added notes about the envshot room
  • Like 2
Link to comment
Share on other sites

9 hours ago, HeresJonny said:

@duzenko I've found a really weird issue, if you look at my material file you'll notice I have two materials: textures/interior_map and textures/interior_map_wtf_green.  If you replace the regular one with the wtf_green one, the texture in fragmentMap 1 takes on a greenish tint.  My workaround was to put a texture I don't use into that slot and move the one I wanted to slot 5 instead. If you do a diff on the shaders you'll see that's the only change.  If you put the same texture into 1 and 5, both turn greenish so I think whatever goes into that slot gets corrupted somehow.  And even if you use the same texture on a totally different material it still goes green!

 

Hopefully will look later this week. If not. ping me in PM on week end.

Link to comment
Share on other sites

4 hours ago, duzenko said:

Hopefully will look later this week. If not. ping me in PM on week end.

I did some code spelunking and found this in idMaterial::ParseFragmentMap:

    // unit 1 is the normal map.. make sure it gets flagged as the proper depth
    if ( unit == 1 ) {
        td = TD_BUMP;
    }

So I'll just figure out the best way to avoid that slot.

Link to comment
Share on other sites

19 minutes ago, HeresJonny said:

I did some code spelunking and found this in idMaterial::ParseFragmentMap:


    // unit 1 is the normal map.. make sure it gets flagged as the proper depth
    if ( unit == 1 ) {
        td = TD_BUMP;
    }

So I'll just figure out the best way to avoid that slot.

Good job. I did not know that. AFAICS it tries to do special handling for compressed bumpmap textures (that use the AGBx format)

Now if you look closer in that code you can see two things:

  • you can add `forceHighQuality\uncompressed\highquality` after slot number to force RGB format, that should workaround it
  • you can add `cubeMap` to load all 6 sides into a single texture slot and sample it easily in the shader

I suggest you try the second path. Let me know if you need any help with it.

Link to comment
Share on other sites

Note that the engine supports two kinds of cube maps:

const static char *cameraSides[6] = { "_forward.tga", "_back.tga", "_left.tga", "_right.tga", "_up.tga", "_down.tga" };
const static char *cubeExtensions[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", "_pz.tga", "_nz.tga" };


You use `cameraCubeMap` or `cubeMap`to try one or another. They differ not just in file names but maybe also orientation, but I'm not sure about that.

You use cubemap like this in GLSL:

layout(binding=0) uniform samplerCube tex0;

    vec4 c = texture(tex0, rayFractions);

You "only" need to come up with a formula for rayFractions :)

Material shader/texture binding is something like

		fragmentMap		0		cameraCubeMap textures/woodyroom

 

Link to comment
Share on other sites

25 minutes ago, duzenko said:

you can add `forceHighQuality\uncompressed\highquality` after slot number to force RGB format, that should workaround it

I did see that overwrote the TD_BUMP flag and was going to try it.  I don't know if I'd want to rely on such a hack, though, since a code change could break it without warning.

25 minutes ago, duzenko said:

you can add `cubeMap` to load all 6 sides into a single texture slot and sample it easily in the shader

That's the main optimization I was going to play with, so thanks for the additional information around that.  As you noted, the fun part is figuring out new math to sample from the cubemap instead.

Link to comment
Share on other sites

27 minutes ago, HeresJonny said:

I did see that overwrote the TD_BUMP flag and was going to try it.  I don't know if I'd want to rely on such a hack, though, since a code change could break it without warning.

That's the main optimization I was going to play with, so thanks for the additional information around that.  As you noted, the fun part is figuring out new math to sample from the cubemap instead.

Your GLSL math look complicated

What I'd want to start with, is somehow pass the room size/location

Can you do that via e.g. the texture matrix?

Link to comment
Share on other sites

59 minutes ago, duzenko said:

Your GLSL math look complicated

What I'd want to start with, is somehow pass the room size/location

Can you do that via e.g. the texture matrix?

It was just a straight port of the original CG shader from the link in the OP, I'm sure there are things I could optimize (one part is specifically there to work around the lack of an if statement).  I'm going to pass in the room size with a vertexParm, and I'm hoping to base the location off the actual object location in order to avoid the room tiling at inopportune locations.

Link to comment
Share on other sites

Awesome! :D This is just what I was hoping when I found this, that you guys would run with it n find a way

to get it into the game. Can I ask one thing. When you get it worked out, can you share please. :) 

 

[Edit] When I load this map up, it's not working like it does in the video. It's just a 2D glass window

with nothing behind it.  Am I doing something wrong???

 

Question. The video, and the Interior Mapping, isn't that just a cubemap though? I don't understand

this at all. I need this for Shops in Venice, but the thing I'm having a bitch of a problem with is funding

textures of interiors of old Venice shops that I can use. Originally, I was going to try to cubemap it, but

this is a far better way, but I still need to find shop interior textures. 

Edited by NeonsStyle

I have an eclectic YouTube channel making videos on a variety of games. Come and have look here:

https://www.youtube.com/c/NeonsStyleHD

 

Dark Mod Missions: Briarwood Manor - available here or in game

http://forums.thedarkmod.com/topic/18980-fan-mission-briarwood-manor-by-neonsstyle-first-mission-6082017-update-16/

 

 

Link to comment
Share on other sites

11 hours ago, NeonsStyle said:

Can I ask one thing. When you get it worked out, can you share please. :) 

Yes, of course!

11 hours ago, NeonsStyle said:

[Edit] When I load this map up, it's not working like it does in the video. It's just a 2D glass window

with nothing behind it.  Am I doing something wrong???

Are you using the 2.08 beta?  I didn't try 2.07 but I'm 99% sure it won't work there.

11 hours ago, NeonsStyle said:

Question. The video, and the Interior Mapping, isn't that just a cubemap though?

A standard cubemap moves with you, you can never get up close to the side and see the perspective shift.  I'm going to try and get this to run off of a standard cubemap texture, but you can create each side (wall/ceiling/floor) manually if you wanted/needed to.  Unlike a standard cubemap, the borders between each image don't need to be seamless.

 

Link to comment
Share on other sites

Thanks for the reply Jonny. I'm using 2.07 64 bit. 2.08 isn't out yet, just in beta. Guess I'll have to wait till its released

I have an eclectic YouTube channel making videos on a variety of games. Come and have look here:

https://www.youtube.com/c/NeonsStyleHD

 

Dark Mod Missions: Briarwood Manor - available here or in game

http://forums.thedarkmod.com/topic/18980-fan-mission-briarwood-manor-by-neonsstyle-first-mission-6082017-update-16/

 

 

Link to comment
Share on other sites

46 minutes ago, NeonsStyle said:

Thanks for the reply Jonny. I'm using 2.07 64 bit. 2.08 isn't out yet, just in beta. Guess I'll have to wait till its released

It's really easy to try the 2.08 beta if you want to, but I plan to keep posting progress videos to make it easy to see how it works.

  • Like 1
Link to comment
Share on other sites

@HeresJonny

What about this trick?

I'm not a mapper or a modeller so I'm not sure how to phrase it right

If we have the window as a "model" (rather than world geometry) then we can agree to have the room center at (0,0,0) local coordinate

The window itself would span from (x1, y, z1) to (x2, y, z2). That should be enough to recreate all the necessary info.

On the other hand converting windows to models might make it cumbersome to map in DR?

Link to comment
Share on other sites

Another approach is adding a geometry shader stage

Considering a window is just two triangles it should not affect performance

When I think about it, it should greatly simplify the texture access math, too

Would you like me to write the shader for testing?

Link to comment
Share on other sites

I would kill to be able to use this. My Venice map consists of 3 in 1 maps. Old quarter, a Discricto Commerciale ( merchants quarter) and
the wealthy part around an icon of the Grand Canal.  The merchants quarter, I wanted to include a few traditional old Venice
shops, that would look fleshed out inside, but couldn't build it out as it'd be a performance hit on a very detailed map. So
to be able to use this method would be awesome. All I need is a texture of the inside of a shop n bang, instant olde venice shop. :D

I know nothing of shaders, so not sure how to use these duzenko, outside a map. Could you make a test map?

I have an eclectic YouTube channel making videos on a variety of games. Come and have look here:

https://www.youtube.com/c/NeonsStyleHD

 

Dark Mod Missions: Briarwood Manor - available here or in game

http://forums.thedarkmod.com/topic/18980-fan-mission-briarwood-manor-by-neonsstyle-first-mission-6082017-update-16/

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 0 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...