IRay Compositing?

marblemarble Posts: 7,500

I'm very new to IRay, having only recently bought a GPU capable of rendering a scene in a reasonable time (I'm getting old, time is precious). It is already clear to me that the 4GB VRAM I have is not enough. For example, I created a scene with the Northern Terrace Street, a G3F and a G2M (clothed) and it dropped back to CPU. I tried reducing the texture sizes of the NTS from 4096x4096 to 2048x2048 but no luck - still too big for my VRAM.

So I wondered whether there was a way I could render the street scene and the people separately (using canvases) and then composite them in Gimp. I've looked for tutorials but they all describe LPE and rendering lights separately which is wonderful but not what I'm looking for. Does anyone know of a tutorial somewhere that I could follow? I'm guessing that shadows might be a problem, among other considerations.

«1

Comments

  • Joe.CotterJoe.Cotter Posts: 3,362
    edited June 2016

    You can render your characters with transparent backgrounds then just layer them over the scene in Gimp.

    An easy way to do this is set up the scene entirely, save it, then delete the characters. Render the scene. Open the original saved scene and delete the background leaving the characters (or character if doing each separately) and render them. Hopefully, you should be able to use the same lighting between the background and characters, but there still might be some tweaking to be done on the lighting since the characters won't be picking up any bounce lighting (and/or potential shadows) from the scene background.

    Unfortunately, going into more compositing then that pretty much requires going through various Gimp/Photoshop tutorials as the skills while being pretty much universal can get pretty extensive depending on the particular things and fidelity your scene requires. Compositing is a study area of it's own, but it's one that is well worth persuing.

    If you take a stab at it and post your results along with where you are getting stuck, people here might be able to help you with specifics for your scene.

    Post edited by Joe.Cotter on
  • 3anson3anson Posts: 314

    okies, yup, layering the 2 renders is easy. the main thing to remember is to have the groundplane set to be a shadow catcher. render to .png and your figures will be on a transparent back

    ground, complete with any shadows they are casting. also..do NOT alter the camera between renders or move the position of the sun.

    then just plop your figures render on top of the BG render, and they will blend in nicely, with their shadows showing on any archtecture/ground surfacein a natural way.

     

    smiley

     

  • marblemarble Posts: 7,500

    Thanks - I'm going to try this as soon as a get some time to play with. Just one thing - are there any Blend Mode tricks I should be aware of? I did have PS CS5 on my Mac but I only have Gimp on the new Windows PC. I have been toying with the idea of buying PS Elements unless there are better alternatives.

    So, to be clear: canvases don't come into it in and I should just do two separate renders?

  • Oso3DOso3D Posts: 15,085

    You CAN use canvasses, which allow you to do a bunch of different renders with different objects drawn in. I find this particularly useful for haze or distance effects.

    Or you can simply do multiple renders.

    However, canvasses are in .exr format, so you need an editor capable of handling them (which, in my case, pushed me over the edge to just going with PS)

     

  • HavosHavos Posts: 5,581

    Hi Marble, I have this set as well, and I have the same GPU as yourself, so I gave this a try myself, and you are correct that just the Northern Terrace Only uses up 3.5GB of memory, leaving just 500MB for any characters or other props you might add to the scene.

    Whilst doing multiple renders, as suggested above, is a good solution, there is an alternative that will let you render it all in one go. From my tests, it is the non-diffuse maps that are using all the memory. I switched off all the non diffuse maps, and GPU memory usage dropped from 3.5GB to about 1.1GB, which is a pretty drastic drop. I switched off both the specular and normal maps, but I suspect it is the normal maps that are eating up the memory. When rendering the whole terrace, rather than close-ups of individual parts, a lot of the normal maps are not really needed, and will make little or no difference to your final render.

    I have attached two renders, one with diffuse only, and one with all maps. The difference is not too drastic, and you could re-add some maps where you feel they will improve the image.

    NTS Diffuse Only.jpg
    1330 x 882 - 168K
    NTS All Maps.jpg
    1330 x 882 - 168K
    NTS All Maps.jpg
    1330 x 882 - 168K
  • evilded777evilded777 Posts: 2,482

    Since this was already out there... and canvasses were mentioned, going to piggy back.  I just discovered something troubling.  I don't use HDRI much as an environment (I use the light, but not as a backdrop is what I mean).  I just noticed yesterday that if I render an environment light canvas, it does NOT light the ground plane.  I get a big black circle where the ground ought to be and i need a beauty canvas to get my ground lit.  Then I have to monkey with it to get the environment canvas and the beauty canvas to work together and not blow out the "walls" or sphere if you will.

    That doesn't seem like the correct behavior, but maybe I am missing something.

  • marblemarble Posts: 7,500

    @Will : I remember reading that about .exr now that you mention it. I don't think the current version of Gimp supports it. I believe it will be supported in 2.10 though.

    @Havos: That's really interesting. I have GPU-Z but I'm not sure it is anywhere near accurate. I believe there were also accuracy problems with the product on sale here which details the VRAM hogs. But I will definitely try without the non-diffuse maps. My only concern is that I wanted a close-up of a single house-front so some kind of height map would have been nice to have.

    Despite the official DAZ word on the full 4GB of the 970, I have my doubts. Mine seems to drop back to CPU anywhere close to 3.5 (again, according to GPU-Z). I don't have my Dell display connected to the GTX970 - it is connected to the Skylake on-board GPU.

  • HavosHavos Posts: 5,581

    I am also using GPU-Z to measure the GPU usage. I have seen memory usage above 3.5GB on my GTX 970, so I think it does use the whole memory. My monitor is also not using the GPU, like you.

    You should be able to add back a few normal maps and stay within GPU, you just have to experiment.

  • marblemarble Posts: 7,500

    Speaking of the Northern Terrace, I see there is a nice NT kitchen interior at PC+ price. I'm a bit concerned that it will also be too much for 4GB VRAM - espcially with a couple of people in there.

  • hphoenixhphoenix Posts: 1,335
    marble said:

    Speaking of the Northern Terrace, I see there is a nice NT kitchen interior at PC+ price. I'm a bit concerned that it will also be too much for 4GB VRAM - espcially with a couple of people in there.

    Again, as Havos mentioned, there are a LOT of maps in it.  Not just diffuse, but normal/bump maps, opacity maps, specular maps....you have to resize ALL of them (based on final render size and distance in scene from camera.)  Also, remember that figures use multiple maps as well.  Hair has it's own maps, so do clothing items.  Pants, shoes, shirts, dresses....they ALL have maps, which are usually a lot bigger than needed (so just in case it's a close-up or such, you do have it.)  And they usually have multiple maps.  A single clothed figure with hair and clothed can be using 20-30 image maps, easily.  So just resizing one won't make too much difference.  This is why it's usually easier and quicker if the PA would do it as they are making the main presets and such.  They already know ALL the maps they are using, so it's easier for them to make some resized ones and a few extra presets.

    You know, I think I've got a new project.  A script that uses a free image resizer (like imageMagick) that it can run externally.  Just select an item, run the script.  Script would run through ALL the maps on the selected item, and run the external image resizer to create resized versions (with "_med" and "_small" on the end of the filenames.)  And another couple of script that when run just changes all the maps on the selected item to point to either the "_med" or "_small" maps.  Maybe have a couple of versions to allow certain maps to not be switched.  Should be pretty simple.  This would obviate a LOT of the issues with this.

     

  • Oso3DOso3D Posts: 15,085

    Isn't that what the image compression setting is for, basically?

    Or are we back to talking 3DL?

     

  • marblemarble Posts: 7,500

    You are right to assume that I only reduced the diffuse textures. There are lots of them in the Street scene and it was tedious so your script idea is a good one. I used the batch resizer from FastStone (freeware) but it was still tedious.

    By the way - I thought it was not possible to shrink a normal map?

  • HavosHavos Posts: 5,581
    marble said:

    Speaking of the Northern Terrace, I see there is a nice NT kitchen interior at PC+ price. I'm a bit concerned that it will also be too much for 4GB VRAM - espcially with a couple of people in there.

    I will almost certain be picking these up (particularly as they go nicely with the monthly freebie), so I will try them out. If the PA has included a lot of normal maps, they could have the same issues as the main Northern Terrace set.

    BTW: I do like these sets for giving us living environments for more "normal" people. Most of the kitchen/bathroom/living rooms sets in this store are huge luxury things, suitable for palaces or the homes of multi-millionaires.

  • marblemarble Posts: 7,500
    Havos said:
    marble said:

    Speaking of the Northern Terrace, I see there is a nice NT kitchen interior at PC+ price. I'm a bit concerned that it will also be too much for 4GB VRAM - espcially with a couple of people in there.

    I will almost certain be picking these up (particularly as they go nicely with the monthly freebie), so I will try them out. If the PA has included a lot of normal maps, they could have the same issues as the main Northern Terrace set.

    BTW: I do like these sets for giving us living environments for more "normal" people. Most of the kitchen/bathroom/living rooms sets in this store are huge luxury things, suitable for palaces or the homes of multi-millionaires.

    Agree completely. I have no interest in SciFi or Fantasy so the more "normal" products, the better. Same goes for clothing.

  • hphoenixhphoenix Posts: 1,335
    edited June 2016

    Isn't that what the image compression setting is for, basically?

    Or are we back to talking 3DL?

     

    Iray image compression uses an on-card set of algorithms to losslessly compress images stored in VRAM (if they exceed the threshold resolutions).  However, the amount of compression varies significantly.  And it applies to ALL images.  A 4096x4096 32-bit image is still 64MB of data.  Even with 75% compression, that's still 16MB of data PER IMAGE.  Considering 2 figures, with clothing and hair could have 50-70 of those, that could be over a Gigabyte of VRAM right there.  Scenery?  There's another half Gigabyte, or more.  Any props?  Could be even more.....easily HALF your VRAM can be holding COMPRESSED textures.  And if the 'medium' setting is larger than the image size, it doesn't get compressed at all.  So your image compression settings for Iray can SERIOUSLY affect how much memory is available, and whether or a given scene will dump to CPU.

    Note that, you will NOT get 75% compression with every image.  Most you'll be lucky to get 50% at best.  So the numbers will be larger in actual scenes.  But not ALL textures will be 4k square size.  Your HDRI can take up HUGE amounts in VRAM too.....using a huge HDRI map when you don't NEED that kind of lighting detail is also wasteful.  If you have the capabilities to resize EXR format files, resize your HDRIs if they don't come in multiple resolutions.  An 8000x3000 panoramic with 6 exposure levels is over 600MB uncompressed just by itself......

    Now, a 2048x2048 32-bit image is only 16MB uncompressed.  That's 1/4 the size.  1024x1024 is only 4MB....that's 1/16th of the original 4k square image.  Now all those maps are only taking up a few hundred MB of VRAM, rather than approaching 2GB or more.....And if those images are being applied to items that are only a few hundred pixels high/wide on the final render....you don't NEED all that resolution on them.

    Post edited by hphoenix on
  • mtl1mtl1 Posts: 1,508
    marble said:

    I'm very new to IRay, having only recently bought a GPU capable of rendering a scene in a reasonable time (I'm getting old, time is precious). It is already clear to me that the 4GB VRAM I have is not enough. For example, I created a scene with the Northern Terrace Street, a G3F and a G2M (clothed) and it dropped back to CPU. I tried reducing the texture sizes of the NTS from 4096x4096 to 2048x2048 but no luck - still too big for my VRAM.

    So I wondered whether there was a way I could render the street scene and the people separately (using canvases) and then composite them in Gimp. I've looked for tutorials but they all describe LPE and rendering lights separately which is wonderful but not what I'm looking for. Does anyone know of a tutorial somewhere that I could follow? I'm guessing that shadows might be a problem, among other considerations.

    Hi Marble, before you go too far into this, you may want to see if your framebuffer is taking up a huge chunk of your VRAM first. I've loaded extremely large scenes before which (surprisingly) fit in my 4GB VRAM. Best way to do this is to use GPU-Z and check the VRAM usage before you render.

    The easiest way to lower your framebuffer usage is to close other windows or unfinished render windows in the background. DAZ itself *will* take up VRAM due to the viewports as well. I'm not sure if switching to wireframe affects anything, but you can see if it helps or not.

    The second easiest way is to switch to integrated graphics for your monitor which *should* change the framebuffer location to main memory instead of VRAM.

    Hope this helps :)

  • Oso3DOso3D Posts: 15,085

    Huh! Good to know, thanks for the tip.

    With my new shaders, one thing I'm running into... you save on texture maps considerably. But the shader runs slower. So the impact to render time is all over the map.

     

  • marblemarble Posts: 7,500
    edited June 2016
    mtl1 said:
    marble said:

    The second easiest way is to switch to integrated graphics for your monitor which *should* change the framebuffer location to main memory instead of VRAM.

    Yes, I do have my monitor on integrated graphics (Skylake i7). I am also careful not to have any hidden windows of part-finished renders. I switch to Texture Shaded Drawstyle insted of NVidia too. So I should be starting from a clean slate.

    Damn this quoting feature of this forum is crappy.

    Post edited by marble on
  • mtl1mtl1 Posts: 1,508
    marble said:
    mtl1 said:
    marble said:

    The second easiest way is to switch to integrated graphics for your monitor which *should* change the framebuffer location to main memory instead of VRAM.

    Yes, I do have my monitor on integrated graphics (Skylake i7). I am also careful not to have any hidden windows of part-finished renders. I switch to Texture Shaded Drawstyle insted of NVidia too. So I should be starting from a clean slate.

    Damn this quoting feature of this forum is crappy.

    My Christmas wish to Santa is for DAZ to have a better quoting system on their message boards ;)

    But yeah, in that case, it seems that Northern Terrace is just a VRAM hog :( :'(

  • hphoenixhphoenix Posts: 1,335
    edited June 2016

    Huh! Good to know, thanks for the tip.

    With my new shaders, one thing I'm running into... you save on texture maps considerably. But the shader runs slower. So the impact to render time is all over the map.

     

    That's always been the trade off between procedural textures and image-based textures.  One is faster, but takes more memory....the other is slower, but uses very little memory.  It's really a question of speed vs. size.  And it is possible to optimize some of the slowness of procedurals away, just as you can use smaller textures or better compression to reduce their size.

    The best of both worlds is to use image-based procedurals, which use a small image as a 'seed' for the basic pattern, then use the procedure to simply refine and add detail.  But since they depend on the image for the 'seed', they are less flexible than a pure procedural, but more flexible than just a straight image-based texture.  You just have to provide different 'seed' images for different effects, and have the procedural able to properly 'develop' the final output based on the seed image.

    And if the speed difference of a procedural shader keeps the scene running on GPU instead of dumping to CPU, it's usually still quite worth it.  If the render took 8 minutes without the procedural on GPU, and with it took 20 minutes, but it would take 80 minutes on CPU......I still call that a win for the procedural!

     

    Post edited by hphoenix on
  • IceDragonArtIceDragonArt Posts: 12,759

    Not sure if you really need to remove the figures or if you can just hide them by closing the eye.  I don't know enough about how Iray works to know if it will ignore them completely when calculating if you just hide them.  But that way you won't have to worry about moving anything accidentally you just hide everything you need to and work your way through.  that's what I do anyway....

  • marblemarble Posts: 7,500

    Not sure if you really need to remove the figures or if you can just hide them by closing the eye.  I don't know enough about how Iray works to know if it will ignore them completely when calculating if you just hide them.  But that way you won't have to worry about moving anything accidentally you just hide everything you need to and work your way through.  that's what I do anyway....

    I wonered about that too. Does it still load into VRAM if hidden? 

  • mtl1mtl1 Posts: 1,508
    marble said:

    Not sure if you really need to remove the figures or if you can just hide them by closing the eye.  I don't know enough about how Iray works to know if it will ignore them completely when calculating if you just hide them.  But that way you won't have to worry about moving anything accidentally you just hide everything you need to and work your way through.  that's what I do anyway....

    I wonered about that too. Does it still load into VRAM if hidden? 

    Off the top of my head, I don't think so? It wouldn't be present in the calculations and render, so I would think it wouldn't take up VRAM...

  • hphoenixhphoenix Posts: 1,335
    mtl1 said:
    marble said:

    Not sure if you really need to remove the figures or if you can just hide them by closing the eye.  I don't know enough about how Iray works to know if it will ignore them completely when calculating if you just hide them.  But that way you won't have to worry about moving anything accidentally you just hide everything you need to and work your way through.  that's what I do anyway....

    I wonered about that too. Does it still load into VRAM if hidden? 

    Off the top of my head, I don't think so? It wouldn't be present in the calculations and render, so I would think it wouldn't take up VRAM...

    AFAIK, hidden objects MAY take up a very small amount of VRAM, but can effectively be considered to not be loaded.  However, hiding things outside the view may cause other issues (as reflective objects that ARE in view won't reflect them.  This is the problem with some scenes that are missing walls or ceilings and such.....big black areas in reflections unless you use a HDRI background or an environment dome.

    Sometimes there is little choice, as the camera can't 'see' through the object if it is in the way.  But this is why I wish it were possible to set an item as 'invisible to camera' but still be seen by the rest of the scene (i.e., in reflections and lighting calcluations.)

     

  • Richard HaseltineRichard Haseltine Posts: 108,067
    hphoenix said:
    Sometimes there is little choice, as the camera can't 'see' through the object if it is in the way.  But this is why I wish it were possible to set an item as 'invisible to camera' but still be seen by the rest of the scene (i.e., in reflections and lighting calcluations.)

    A section plane, if you turn off Clip lights (it's on by default).

  • hphoenixhphoenix Posts: 1,335
    hphoenix said:
    Sometimes there is little choice, as the camera can't 'see' through the object if it is in the way.  But this is why I wish it were possible to set an item as 'invisible to camera' but still be seen by the rest of the scene (i.e., in reflections and lighting calcluations.)

    A section plane, if you turn off Clip lights (it's on by default).

    I've heard about these, but haven't actually played with them yet.  How does one create one in a DS Scene?

     

  • HavosHavos Posts: 5,581
    hphoenix said:
    hphoenix said:
    Sometimes there is little choice, as the camera can't 'see' through the object if it is in the way.  But this is why I wish it were possible to set an item as 'invisible to camera' but still be seen by the rest of the scene (i.e., in reflections and lighting calcluations.)

    A section plane, if you turn off Clip lights (it's on by default).

    I've heard about these, but haven't actually played with them yet.  How does one create one in a DS Scene?

     

    From the menu

    Create->New Iray Section Plane Node

    You will need to move it around to get it to clip what you want, and may have to flip it 180% to ensure it is clipping in the direction desired. This is best done whilst using the interactive iRay view port that can show you how the clipping is working

  • hphoenixhphoenix Posts: 1,335
    edited June 2016

    Okay, I've started work on the scripts needed to produce resized textures to save on GPU memory.

    Interestingly, in the process I got some very interesting data points.

    Selecting just a figure (no clothing, or hair, just the figure....specifically Aiko6) resulted in 21 total unique maps (they're shared if other things use them, so no multiple copies.)  (ETA:  Should note I was using the IG Iray presets for Aiko 6, so there may be some variance on the map numbers and sizes with original 3DL presets)

    Of those 21 unique image maps, 14 were 4096x4096 in size.  The other 7 were 2048x2048.

    That's 64MB (uncompressed) per 4k x 4k image, and 16MB per 2k x 2k image.  (Iray stores all images as 32-bit, regardless of alpha or greyscale).

    That's 896MB in 4k x 4k images, and another 112MB in 2k x 2k images.  Total before any compression?  A whopping 1008 MB, or just under 1GB.

     

    That's ONE nude figure with no hair.  Almost a gigabyte of textures.

     

    Even assuming 50% compression, a single Genesis 2 Female, nude and bald, would be taking up 504MB of VRAM, just for their image maps.  That's a LOT.  So 7 nude bald figures (give or take) with no props or scenery would pretty much max out a 4GB card (fewer figures if you use IBL with an HDRI.....those go on the GPU VRAM too!) since the card has to also store the geometry, and some space for buffers.

    Now typically, hair and clothing won't use as many maps.  SOME can, but most won't.  Hair usually has around 5 maps, but could go a lot higher.  Clothing is usually 6-10 maps for a full outfit, but could easily be more or less depending on the complexity.  Scenery is completely up in the air.....could be any number.  Same with various props.  I'll make sure my script shows some stats when it completes for a given object, so you can make some decisions.

    But a good estimate at this point is a single character, with hair and clothing, is going to take up 0.75 - 1.0GB total, unless you resize those images.

     

    Post edited by hphoenix on
  • marblemarble Posts: 7,500

    This is going to be a great help. It was one thing to batch resize the images but the real time consuming effort is manually selecting each diffuse/specular/bump/etc. map in turn - for everything in the scene.

  • marblemarble Posts: 7,500

    If you get this script working, I hope the vendors will also use it to provide scaled down textures as options.

Sign In or Register to comment.