Page 1 of 2

Need help with 3dsmax lightmaps (again)

Posted: 2013-09-18 12:50
by Mineral
I mostly need tips really.

When rendering them for bootcamp it all went fine as it was a small map.

Right now I'm the progress of rendering them for Shikotan Island but I'm really stuck.

The main problem I have is the duration it takes to import the statics. I devided the map's statics into multiple 'passes'. So I don't have to render them all at the same time.

So each time I load in the overgrowth(18000) and about 700 statics for each pass(total of 5000 or so statics).

The problem is this takes about 10 to 13 hours to import each time. This is something I can't keep doing as I can't leave my pc on for that long each day.

I'm asking for tips of people who have done this before to see if there is a better way of doing it. Or tips to boosts 3dsmax performance(like the additional memory command, can somebody explain?).

Or is it simply futile and will it always take this long? then I better just load all statics at the same time and render it all at once. Any tip would be appreciated :)

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-18 13:00
by Rhino
[R-CON]Mineral wrote:The main problem I have is the duration it takes to import the statics. I devided the map's statics into multiple 'passes'. So I don't have to render them all at the same time.

So each time I load in the overgrowth(18000) and about 700 statics for each pass(total of 5000 or so statics).

The problem is this takes about 10 to 13 hours to import each time. This is something I can't keep doing as I can't leave my pc on for that long each day.
The trick is to only do lightmapping once (especially for 3DsMax LMs) and when the map is pretty much final, other than lightmaps and possibly GPO stuff etc which doesn't affect LMs. If you want to do some basic test LMs just do them with the editor with low or medium settings but I only LM the terrain for basic testing or if doing them on final settings, only LM a few test objects and like one terrain patch but I only really do that to test the LM settings.
[R-CON]Mineral wrote:like the additional memory command, can somebody explain?
This just opens up the script to use more of your ram so it doesn't run out of its default allocation and if it runs out, it simply crashes.
[R-CON]Mineral wrote:Or is it simply futile and will it always take this long? then I better just load all statics at the same time and render it all at once. Any tip would be appreciated :)
Pretty much. Importing the statics in phases with a restart in-between each one may help providing you don't waste any time in-between each phase where your PC is doing nothing but its going to be very slow w/e you do.

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-18 13:09
by Mineral
Yeah I guess I will be importing all statics at once then. this will take a day or 2. Cause it seems loading up a saved scene with everything in it goes pretty fast so that's a good thing. So once I have imported everything I can render as much as I want and do simple changes.

But doing this is steps is just too annoying.

Yeah, Rabbit says for him the map is final. And the editor for some reason always crashes for him when rendering lightmaps. I also have a script ready that checks for changes between map versions (the statics) so it leaves out statics that haven't changed. This should help if rabbit should decide to move a few things around :) (thanks to hawker btw to help with the script!)
This just opens up the script to use more of your ram so it doesn't run out of its default allocation and if it runs out, it simply crashes.
So would you recommend using it? What do I have to do exactly. the official doc is really unclear.

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-18 13:59
by Rhino
[R-CON]Mineral wrote:Yeah, Rabbit says for him the map is final. And the editor for some reason always crashes for him when rendering lightmaps. I also have a script ready that checks for changes between map versions (the statics) so it leaves out statics that haven't changed. This should help if rabbit should decide to move a few things around :) (thanks to hawker btw to help with the script!)
What's this script excatly? is it just a normal comparison script or is it more technician than that? Would be really good to have :)

The problem is that if statics change, then its not just as simple as importing the new ones, you also need to delete out the old ones from the max scene and also reLM any statics that while haven't changed location, are going to have different shadows cast on them from the changed statics.
[R-CON]Mineral wrote:So would you recommend using it? What do I have to do exactly. the official doc is really unclear.
The "official doc" or tut has quite a few mistakes in it and ye, that bit is only mentioned in the comments of it iirc, really I need to make my own LMing tut but ye, don't have the time and not sure how helpful it would be at this point :p

Anyways it only really applies when importing the terrain since its so memory intensive but here's more info: TurboSquid -- Forum Posts
3dsmax sets aside a set amount of memory for use in scripts, the import plugin you are using is one such script.

Load the Listener window (F11) type "heapsize" and push enter and it will show how much memory is being allocated for use in scripts.

To increase type "heapsize += 10000000" where 10000000 is the amount of bytes to increase by. You can't decrease, reloading 3dsmax will set the assigned memory to default. Don't increase the memory too much, I think default is about 20 meg, try increasing it by 10 meg at a time and importing the file. You could add the heapsize command to a startup script so you always have more memory for scripting purposes, but this leaves less memory for actually working in max.

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-18 14:28
by Mineral
script is in python. I haven't used it on a full map yet but it works really well on the test's I made. Hawker is good at this stuff :D Two problems exist:

-statics with same rotation might be seen as 'changed'. So it will load objects that aren't changed. Minor difficulty as it will load a small % too many objects.
-statics that cast shadows on those that changed won't be included. I guess you can circumvent this by moving the statics that cast those shadows by like a rotation of 0,0001 or something. can't see another way around it. Or by writing more complicated code that includes statics in a radius around the coordinates of the changed statics :D

But atleast it's 10x faster then handmaking a staticobjects.con file or rendering them all at the same time.

I can only explain the first 17 lines, hawker wrote the rest :p As some of that is really chinese for me.

Code: Select all

import difflib
import string

baseInput = open("staticobjects.con").readlines()
modInput = open("staticobjects2.con").readlines()

finalOutput = open("staticobjects3.con", 'w')

for line in modInput:
    finalOutput.write(line)
    if 'endIf' in line:
        finalOutput.write('\n')
        break

diff = difflib.ndiff(baseInput, modInput)

blockIndices = []

for line in diff:
    if '+ Object.absolutePosition' in line or '+ Object.rotation' in line:
        actualStr = line[2:]
        findStart = False
        for idx, secLine in enumerate(modInput):
            if actualStr == secLine:
                for i in range(1, 10):
                    if('Object.create' in modInput[idx - i]):
                        blockIndices.append(idx - i - 1)
                        break
                    
                findStart = True

            if 'Object.create' in secLine and findStart == True:
                blockIndices.append(idx - 2)
                findStart = False

# When something was added at the end of the file
if findStart == True:
    blockIndices.append(idx + 1)
    
for idx, lineId in enumerate(blockIndices):
    if(((idx + 1) % 2) != 0):
        for line in modInput[lineId:blockIndices[idx + 1]]:
            finalOutput.write(line)
        finalOutput.write('\n')

finalOutput.close()

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-19 17:57
by Mineral
and here we are again :D

My lightmaps look fine, but for some reason they aren't showing in the editor. And I have no clue.
The names,file format's, the way they look is all fine but it's not showing for some reason.

Rendered by editor:
cliff30m=00=-1437=203=-456.dds DXT1 256x256
Image

rendered by max:
cliff30m=00=-1437=203=-456.dds DXT1 512x512
Image

They simply aren't showing in the editor. They don't have any other geoms and it's the same for all statics of this pass. While with the editor they obviously show as usual.

https://dl.dropboxusercontent.com/u/646 ... bjects.zip
74kb file with some lightmaps I made. So somebody can check if they are indeed correctly made.

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-20 11:59
by Mineral
sad bumpy :(

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-20 12:04
by Rhino
Dose the editor LMed version showing in the editor? Your .zip doesn't contain the max made LM?

Only reason I can think of to why to it might not be working is the coordinates are off from where it actually is on the map from where your LM is LMed for.

BTW, 512x512 is pretty large LM for that cliff especially since its only self shadowing. If it had something like a tree casting a shadow on it then might need 512x512 but 256x256 should be fine even so.

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-20 12:20
by Mineral
they show up after restarting the editor yes. (the editor rendered ones)

The naming is exactly the same and the coordinates match. I'll play around with it a bit more today.

Yeah saw the size too. Must have made a mistake there cause I tried matching them to the normal sizes the editor uses.

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-20 13:13
by Mineral
still nothing :( .

With editor:
Image

With max:
Image


the lightmaps of both editor and max(202kb):
https://dl.dropboxusercontent.com/u/646 ... htmaps.zip

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-20 13:25
by Rhino
I can't see anything wrong. Its probably something super simple like you putting it in the wrong folder or wrong map or something super simple like that your totally missing it :p

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-20 13:29
by Mineral
Yeah that's what I'm thinking too.

file naming - check
coordinates - check
fileformat - check
foldername - check
editor settings - check

Gonna try another map now.

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-09-20 16:43
by Mineral
while I thought it wasn't a lightmap issue, as they looked fine. Turns out it was :D

Forgot to turn on the shadow rendering of the Sunlight and used the wrong render method. All fixed. Sorry for wasting your time m8. Should have found this earl-yr.

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-10-09 14:11
by Mineral
Issue number 3, For some reason certain objects become hidden when rendering lightmaps. Objects that need them simply get passed and don't receive them. This includes it seems random objects like

house_dest houses, (but not the walls)
the vadso lighthouse
cargoship parts
rocks...

I think only about 2/3 got actually rendered. No matter what I do it doesn't get rendered and they become hidden in max.

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-10-09 14:19
by Amok@ndy
sounds strange usually only lods get hidden, have you set up the lightmapresolutions right ?

for the house_dest you need to generate the wreck LMs aswell to show up ingame, dont forget that or you will search hours why the hell the lms doesnt show up right later ;) [speaking out of experience here]

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-10-09 14:25
by Mineral
Yeah, run into that problem with bootcamp with the wreck meshes :D But yeah, lightmap resolutions are right. Doesn't seem logical it would hide these meshes. And don't really want to spend time loading them all in again to see if that fixes things :D

the resolutions:

For example astra(has 2 lods in mesh):
astra_red 128 64 32

house dest all have 3 lods:
house_dest_2a 256 128 64 32
house_dest_5a 256 128 64 32
house_dest_1a 256 128 64 32
house_dest_3a 256 128 64 32

lighthouse with 3 lods:
lighthouse 256 256 64 64

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-10-09 14:32
by Amok@ndy
and you dont get any results when lightmapping them ? so the temp folder is empty ?

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-10-09 14:38
by Mineral
yeah, when I select a house dest that normally dissapears, it simply doesn't render it and then it hides all the ones it always hides for some reason.

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-10-09 14:40
by Amok@ndy
maybe shoot pleym or AF a PM, if i remember right i have always done the house_dest in the editor cause they dont work well in 3ds

and yeah pleym and AF will know the best about the lighthouse never used that static

Re: Need help with 3dsmax lightmaps (again)

Posted: 2013-10-09 14:52
by Mineral
well I'm using those as an example really to list here. it's over 50 different ones. And it's weird as house_dest and some the cars worked perfectly fine on my previous map(bootcamp) I did in max.