Interior mapping shader

Yes, Rens. Please add this Z or Y up option. Thanks!

Hello again! Happy Monday!

After the weekend break I’ve jumped back into this and while I’ve added some features I’ll most likely need, I have created/discovered some issues along with them.

Below are some of the issues along with a slightly modified version of Ren’s code (I sincerely hope you don’t mind my hacking and slashing at this…)

  1. Outside Walls

The outside walls show an interior; this is an obvious problem as we should be seeing straight through them to the outside world. I don’t even a little know how to address this.

1. Inverted Floors
[/B]

The floor texture renders inverted. All other textures are facing the correct way, including the ceiling. Again, I am unsure how to address this.

<strong>1. Uneven Floor Number
  \[/B]

  If the user provides an odd number to the number of floors the rendered geometry is offset in a way that puts it under sea level and all sorts of uneven. I attempted a fix by changing fScale to a vector vScale and scaling the geo only in that direction. Sadly, this did not work as expected. The scale is applied from the center of the geometry and is always offset in that respect. I suspect any odd number of floors would never render correctly.

  However, I believe this can be fixed by modifying the intersection location up and down with an offset parameter. The existing vOffset only seems to shift the wall textures around?

  <strong>1. Atlas Rows?
    \[/B]

    I know that you haven't addressed this as of yet, I'm curious if another AtlasMap needs to be provided for "lights off" textures? Is this what the AtlasRows parameter should be addressing? I created the above image and increased AtlasRows to 2, but nothing happened.

    <strong>1. Color Out vs Result\[/B]
      When I render Result, I simply get black geometry; the only working render is Col Out which currently doesn't support emission or lights on/off?

      <strong>1. User settings (Y up vs Z up)\[/B]
        Well, I thought I'd fixed the Y up issue by changing the
        ```
        #define X 0
        #define Y 1
        #define Z 2
        ```to```
        #define X 0
        #define Y 2
        #define Z 1
        ```

        While that ***did*** correct the orientation of the room textures, it did not correct the user settings. The Room Count, Offset, and my added vector Scale attributes still function as Z is the up vector.
      \[/LIST]

      If anyone can and wants to help address these, I'd be very grateful; I'm a bit out of my element with OSL though I do know my way around scripting (python, tcl, etc).

      Here is the script as I have edited it: [http://pasteall.org/80399](http://pasteall.org/80399)</strong>
    </strong>
  </strong>
</strong>
![outsideWalls1.JPG|662x642](upload://5N9xXnN64idxV0cRIYXcNWWIVvf.jpeg) ![invertedFloor1.JPG|662x642](upload://faJxU8G5chXVkl3QH5IkHM8Z2aS.jpeg) ![atlasMap\_v003.JPG|1551x110](upload://4XOb2FVxuprwu8tizTORcfmF9fJ.jpeg) ![offsetUnevenFloors.JPG|662x642](upload://8FrKXJZyqsY8birCGCX58ntJlQx.jpeg) ![atlas2Rows.JPG|1546x266](upload://feVUXdRyoweEWSbDZGHkNbBxoed.jpeg)

Wow, nice! Great stuff to work with. :slight_smile:
We just moved, however things are settling down again, which will put me back on track for OSL again. I have some other updates for the int shader, but I’ll definitely look at your suggestions.

Awesome, I just found this as well. I too would love to be able to, or to know how to have a random assortment of different bitmaps so each floor isn’t the same, it’s not immediately obvious how to do that right now…seems like I’ve been having to make more and more buildings and cities recently and this would be really handy to have in my toolkit.

I’ve tried for a bit but can’t wrap my head around the code enough to get it right.

I actually want a simplification of the shader. I’m looking to generate a single room instead of a 20x20x20 structure. One room per plane would be the idea.

I modified the code to switch Z and Y, I’ll work on it some more tonight and upload a new version with some other cool features soon. :slight_smile:

I wanted to drop a note of thanks and to ask whether you’d been able to make more progress on this.

I have! I’ve updated and changed several things, I’ll try to upload the current version so at least you’ll have an updated version to use, then add the rest of the planned features.

Awesome Rens! I’m really interested in this as well, for Maya. Thanks for any updates!

edit: I do have it working in Maya Vray, but with wacky coordinates and flips. But does function.
-John

Hey everybody, here’s v5! I’ll upload some example of the new features soon, but here’s the shader already!

http://www.rensheeren.com/osl/interiorMapping\_tex\_v005.osl

There’s a new feature that scales the rooms to fit the bounding box of the object so you have properly fitting rooms, however it needs vrayusercolors as inputs so the shader can know the size of the object, use this script to generate the data (in max):


for o in selection do
(
	v_min = in coordsys local o.min
	v_max = in coordsys local o.max
	s_min = (v_min[1] as string) + "," + (v_min[2] as string)+ "," + (v_min[3] as string)
	s_max = (v_max[1] as string) + "," + (v_max[2] as string) + "," + (v_max[3] as string)
	setUserProp o "intMap_bboxmin" s_min
	setUserProp o "intMap_bboxmax" s_max
)

Then bring in the vrayUserColors set to intMap_bboxmin and intMap_bboxmax and connect. By default the mode is on so please disable for using it without it. :slight_smile:

Ok, more to follow but sleepy time now!

To do:
- UV mode if possible at all.
- Texture lighting.
- Test/implement y up.
- Room rotation instead of random per wall so lighting stays connected.
- Side rooms have no walls on outer box wall, so you can see through the corners of the building.
- Color temperature (K) varation.

Known issues:
- WIP.

Notes:
- Connect the atlas image.
- Lighting mode:
0 - atlas base texture only
1 - multiply base with lighting
2 - replace base with lighting

v6! Added outer wall removal which was a bit of a bad boy to sort out, works only with the room fitting option from the previous post (needs the script) as the shader needs to know where the outer rooms are.
http://www.rensheeren.com/osl/interiorMapping\_tex\_v006.osl

v005 2016/12/21 (rh)
- Cleaned up more code.
- Added room fitting to bounding box.
- First setup of Y is up Maya mode, needs testing.
- Changed to room size.
- Texture inputs and code for separate lighting maps.
- Added lighting modes.
v006 2016/12/26 (rh)
- Added outer wall removal.
- Reworked UI a bit.

BTW that’s still a box with 6 polys.

Burn the witch :smile:

Haha! Wait until you see the option to add a layer of cards to add desks and people in. :smile:

This looks so nice. I have questions :

1) Do you foresee a way to handle curved buildings?
2) Do you think you might be able to handle wall/floor thickness values? Right now, the walls are infinitely thin, which doesn’t look quite right.
3) Do you think you might be able to integrate the bumpy glass OSL code into this one, so that there are windows (between the walls), that have irregularities like real buildings? I wasn’t sure whether the plan was to make an onion building, where the interior is generated on geometry inside the outer, though, or a universal ‘building’ shader was planned.
4) Would the code support variable sized rooms (e.g. double width/depth) to provide some variation in the look and feel?

Hey Phil!

1) Likely not, at least nothing comes to mind now on how to do that. Well, maybe offset each floor (level), but that’s going to be pretty complicated.
2) Yes I have been thinking about this, I’m able to move the walls around randomly and it should be possible to have parameters for wall and floor thickness.
3) The ArchGlass shader? Yes, that’s the plan, it looks like it might be best to have an input in the ArchGlass shader for a self-illuminating map (the interior mapping shader in this case) as using a VRayBlendMtl doesn’t give correct blending of the two yet, though I need to do some more testing, might be some code issue. The other options is to have onion geometries like you said.
4) Very likely, and technically you could use the randomLit_raw alpha output of one intmap shader, pipe that through a channelMixer shader to shuffle the alpha into RGB, do some colour corrections, and use that as a mask to blend it with another intmap shader with deeper rooms for example. I’m planning on making that mask have a horizontal component as well so you will have multiple rooms next to eachother with the same settings (or lights) like in real buildings.

Cheers

As for 1), you can use curved buildings currently, there just needs to be a way to have the room depth follow along if needed.

This is done, I just need to iron out some oddities with it.

3) Do you think you might be able to integrate the bumpy glass OSL code into this one, so that there are windows (between the walls), that have irregularities like real buildings? I wasn’t sure whether the plan was to make an onion building, where the interior is generated on geometry inside the outer, though, or a universal ‘building’ shader was planned.I now have updated the archGlass shader to accept a selfilluminated input. It works well.

4) Would the code support variable sized rooms (e.g. double width/depth) to provide some variation in the look and feel?
So I have now added to horizontal variability component to the light mask so you could use that as a mask to blend different room widths together. However it would probably look a bit Harry Potter-ish as you might see a deep room in one window and in the next window you see a small room where you would expect the larger room to be. Anyway, it’s on the list.

Here’s the changelog so far for v007:
- Connected map multipliers.
- Fixed alpha issues.
- Fixed ceiling text flipping.
- Decoupled room and lighting random numbers.
- Decoupled room and row random numbers.
- Added room rotation so floors/ceilings and walls match up.
- Added horizontal light and mask scaling as lights tend to be switched on or off by floors or mult rooms in office buildings.
- Added wall and floor thickness.

I’ll upload the IntMapping and ArchGlass shader soon, hopefully this weekend, along with some other new nodes. : )

Hi Rens, any progress on that upload? :slight_smile: I have an office project coming up and I like to know if it’s something I can use. I’ll try v6 for now. Thx!

Here’s the latest, haven’t fixed that wall thickness bug yet (perspective is off), let me know if this works. :slight_smile:
http://www.rensheeren.com/osl/interiorMapping\_tex\_v007.osl

And ArchGlass with an input for the InteriorMapping shader so they can be used together easily:
http://www.rensheeren.com/osl/archGlass\_mat\_v003.osl

Enjoy!