The dreaded "GPU out of memory"

Question

Greetings all! I am working on a personal project and I am struggling to render it. I'm using K-Cycles (I've also tried plain Cycles) and I keep getting the message that my GPU is out of memory. There's still particle piece of the project that I haven't bothered adding because I know this will definitely not help things. Outside of outsourcing the render, are there any tips or tricks that you know of to help with this? 

  • wardred replied

    I'd guess there are at least a couple things contributing to that message.


    1 - Sheer number of vertexes.  If there's anywhere you can simplify things, that could help. . . though that might be challenging if everything's already textured.

    2 - Textures.  If you have a ton of high density textures that may be contributing to the issue.  Is there anywhere that a texture could be a generated texture instead of a hand drawn texture?  Are there any textures that are way higher res than they need to be?  If you've a relatively low detailed thing textured at 4k, that's not helping you.

    3 - Maybe bake layers before rendering?  Bake your textures, normals, etc.


    I'm sure there's a ton of other considerations, but those are what I can think of.


    Oh, maybe break your scene up a bit.  Have all your assets all in individual files, and a "full scene" file that links to said assets.  In each of the individual files bake what you can.


    If it really is just that dense of a scene you may be looking at some really crazy solutions.  Like having a block out instead of a real object in your scene - so you get shadows - and rendering a high res asset, like a person or complex robot - in its own thing, then composting the two scenes together.  That sounds like a ton of work though and I'd avoid it unless you absolutely have to go that route.


    Just out of curiosity, what's your video card?  Is it a dedicated video card, or is it integrated and using shared memory?

    What OS?

    How many verts in the scene?

    How many textures do you have, what's the resolution on them?


    Luck!


    (This is just what I thought of, off the top of my head.  Google's your buddy and may have better answers.  More experienced Cookiers may have more insight.)

    1 love
  • Omar Domenech replied

    Yes, just as Wardred says. You video card has limited amount of memory, if your Blender scene is too heave, when you hit render and it can't all be stored on memory, then it's time to save up on resources. 

    You can start by turning off subdiv to objects that are for away on your scene and don't really need that much geometry. See if there's objects that can get away with 1 level of subdiv and still look good. That will save you on vertex count. Next up try linking object data on objects that are alike. For example bolts on a machinery, you shouldn't really be Shift + D and duplicating them when you can save up on resources and ALT + D to have linked duplicates. If they are already their own duplicate, you can Control + L and link their object data. Next up try getting your 4K textures to 2K, if you got any. Next up see if you can have your assets on a separate files and link them into one master file where you do the layout of everything. Linking your geometry saves up enormously on memory. And last but not least, you can render your scene by chunks and put it together in compositing. That is what used to be the old render layers. And then there's always the dream of getting an awesome super expensive video card that will make your life easier until you start doing come complex scenes again and also make your expensive card run out of memory. 

    1 love
  • Martin Bergwerf replied

    Hi rrobdomenech ,

    What I do, when that happens is to render with CPU. K-Cycles might not do that, but Cycles will...and your CPU probably has a lot more memory than your GPU.

    1 love
  • robdomenech replied

    Wardred,

    Thank you so much for this response! I'm still a newbie with 3D, but I'm trying. I will look into baking my textures, as well as looking for lower texture resolutions although I'm pretty sure I've already paired everything down to 2k. I am not aware of linking objects in a scene, but it is something I will happily look into. As far as your questions go, here are my answers:

    Video card: RTX 3080

    OS: Windows 10

    Number of verts in the scene: 2,343,480

    Number of textures in the scene: Not really sure how to find this. See above where I claim "Newbie" status :)

  • robdomenech replied

    Omar,

    Thanks for the input! The idea of using linked objects using Alt+D instead of Shift+D sounds like a great way to save on resources. I know for a fact that I did not hit Alt+D even once when putting this scene together, so I will definitely look into swapping some assets out with linked ones. Are there any good resources you can point me to in regard to your comment about having assets in a different file then linking them to the scene? Wardred mentioned something similar above and I do want to look into this.


    Many thanks!


    PS. I honestly cannot believe that another Domenech is in this community. That's a first for me!

  • wardred replied

    rrobdomenech - I'm not certain of the best way to do this myself.  One way to do it is to go to the top left where you can change 3D viewport to, say Image Editor.  From the editor in the middle top of the screen you'll have a dropdown with all your images listed.


    I'm not certain that's the best way to do things, but it's one way.  I like having all my images packed into the scene, where practical, but it can make managing the images a bit trickier.

    1 love
  • Omar Domenech replied

    First for me as well Rob. Though I think I've seen you around, I don't know why I have that feeling. 

    Kent is working on a course that I think will be released soon where he teaches about linking and asset library. It's this one:

    https://cgcookie.com/p/cubicity-blender-course

    And here's a Cg Cookie YouTube video with a brief explanation on kiunking:

    https://www.youtube.com/watch?v=r7G13NPvXuc

    1 love
  • robdomenech replied

    I just started going through the "Astray" tutorial and Kenan goes over the topic of using linked assets from different files within the first two modules! PERFECT!


    Thank you again, for everyone's help on this.

    • 👌