..Lightmap headache..

Started by Naughty Alien, September 10, 2017, 03:52:48

Previous topic - Next topic

Naughty Alien

...well..im running out of options here..i just cant make lightmap work, no matter what i try..and there is not many commands which does this, so options are limited..actually, i havent seen a one single lightmap tutorial as well, or anyone who actually did it on AGK forums..

..now...i managed to do it initially, over few of my levels i have converted. but, it worked in such way that i had to export my level in to thousand of small parts and then iterate trough/load each and each lightmap individually as well as texture..thats a lot of work and very very complex pipeline, if anything need to be changed, and very hard to track down what went wrong and need to be modified.. not to mention massive amount objects in the folder...

..So, normal way of doing this would be, load whole level as a structure and then iterate trough objects and texture/lightmap each..B3D doing it over decade, AGK commands for this does exists...but nothing works, or at least, i dont know how to use it...i mean, how complicated this could be??

..has anyone here ever try to play with this at all ? AGK forum is less helpful about this than this one here, and i already post there this question which turned out to be very hard to be answered and there is no answer at all..a bit disappointed..

MikeHart

No I didn't have used light maps before. The only suggestion I have is writing to TGC or inside the release topic of the latest release. Paul is really open for suggestions and answering to problems.

Naughty Alien

..what striking me is, i cant find any documentation which will instruct me about boundaries, if any, when we talk about art pipeline..like a .. do's and dont's .. even more...guy on TGC forum who tested files with me, couldnt run his own FBX (ASCII), but binary work fine, while on my side, i can export both binary and ascii and both works..so, its a land of confusion a bit..

@Mike
Who is that gentleman (Paul), and how can i contact him?

Xaron

I think in general the AGK users are not very deep into that stuff in the majority. ;)

MikeHart

Quote from: Naughty Alien on September 10, 2017, 11:16:55
..what striking me is, i cant find any documentation which will instruct me about boundaries, if any, when we talk about art pipeline..like a .. do's and dont's .. even more...guy on TGC forum who tested files with me, couldnt run his own FBX (ASCII), but binary work fine, while on my side, i can export both binary and ascii and both works..so, its a land of confusion a bit..

@Mike
Who is that gentleman (Paul), and how can i contact him?

Paul Johnston, the main developer of AGK.  I would write in the latest release topic to get his attention. Maybe attach a sample script, makes it easier for him.

https://forum.thegamecreators.com/thread/220450


Rick Nasher

I'm probably way off(not deep enough into 3d/lightmapping knowledge),  but as FBX is the more advanced and also more complex file format, isn't it an option to convert to OBJ and do it as in the 3D-FirstPersonExample (aka the theater example)?

I see they are using OBJ for it. Pehaps there's are reason for it?

_______________________________________
B3D + physics + shaders + X-platform = AGK!
:D ..ALIENBREED *LIVES* (thanks to Qube).. :D
_______________________________________

Naughty Alien

#6
..well..thats the exactly one of the problems..OBJ file format, far as i know, doesnt support 2 UV channels, yet, example mentioned using OBJ..now..as i mentioned before, i did managed to export some of my levels(B3D), as it is done in FirstPersonExample, which means, everything i have had in my level is exported as an individual object..that worked except, i ended up with 983 individual objects exported in my folder and then for each i need to know texture used which can be done by renaming it with texture name..but again..what if some objects share texture, which is common, but require different shaders, and so on...its very complicated pipeline to do things like this..and dynamic shadowing will not like such fragmented scene at all..

..on another side, im failing to apply lightmap on to B3D file which by default run 2UV channels exported properly and runs just fine in B3D..each UV channel is exactly at same slot as AGK likes it to be..still..no success..so..i just dont know..

Qube

Have you tried the Collada file format ( .dae )? - That supports 2 UV channels and is supported in AGK.
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Naughty Alien

..i havent try DAE..i did try FBX together with some other folks at AGK forums..FBX exported from blender act very different than one exported from 3dsmax, for example...ASCII FBX exported from Blender, doesnt work in AGK, while binary does work..at same time FBX exported from 3dsmax works both, ASCII and Binary (to be loaded and diffuse texture attached, no lightmap)...this clearly indicates that art pipeline must be addressed in sense that do's and don'ts must be really known, which is not case, or i dont know how to find corresponding documentation..

..for example, there is no information, from where to read scene object name..where AGK is expecting it to be?? Object matrix, material declaration?? where?? Thats why, inside B3D file, i cant get any object name, but i can texture them 'blindly' by iterating trough 1 up to last id exists...and if you try to texture object with ID which doesnt exists, AGK will NOT throw any error...eh..

Qube

I had issues recently with FBX and AGK and came to the conclusion that AGK supports a specific version of FBX ( at a guess 2013 ). For me I found that DAE worked better and along with keeping the UV set also kept the bone animations ( until things become more complex ). I do think that AGK needs a good overhaul of it's 3D file format support as it is very temperamental and picky. I think it works best with the .X file format but my choice of modeller / animator ( Cheetah3D ) does not output .X and I've not had the passion to search and test convertors.

AGK does need enhancement on the 3D side. It needs to support multi texture models and increase file format compatibility. I'd even settle for their own file format and have included decent file convertor utilities.
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

MikeHart


Naughty Alien

..here is new moment, why i have no clue what to think now...now, let me explain details..

Structure of exported B3D file is as follows:

-UV map set 0 is reserved for diffuse textures
-UV map set 1 is reserved for light map

These are basics, and i havent mess with anything and i have made it as simple as it can be. Tested by plain loading in vanilla B3D, as you see on the pic bellow




..now..since i was unable to make light map work, i have decided to do something stupid..test is as follows:

STEP 01
Load geometry, and texture diffuse only, by applying diffuse texture on to its dedicated UV slot (UV slot 0). Light map is not attempted to be loaded. Red circle marking in the pic, is UV map channel for that particular texture ill be testing only. Rest of the textures ill leave as they are. Result is as you can see on the pic bellow.




So far so good. All looks normal.


STEP 02
Now i will change UV map slot for marked texture shown on STEP 01. I have set that texture UV slot to 1 (Light map slot). What i was expecting to see is, stretched mentioned texture , or not proper texture alignment due different UV map settings between UV0 and UV1. On my surprise, UV structure of texture remain same, its just gets brighter, like ADD blend mode is applied, as you can see on pic bellow.



..now..how on earth this can be normal ?? Same geometry works fine and both UV sets are properly loaded/set as it is visible in default B3D load. How can possibly diffuse texture with changed UV slot, be unaffected in terms of UV scale is beyond me..I just dont know what to think about this thing..i cant grab on to anything..

markcwm

Hello, it seems what you're doing, using a 2nd uv set, is out-dated, the way to do it today is use a shader to assign things.
https://forum.thegamecreators.com/thread/216111

If I understand, SetObjectMeshImage textureStage parameter just sets a different texture id not uv set.
https://www.appgamekit.com/documentation/Reference/3D/SetObjectMeshImage.htm

Naughty Alien

..i dont see any shaders loaded/assigned in example where they using OBJ file for lightmap?? As for SetObjectMeshImage, according to documentation, its used as SetObjectMeshImage( objID, meshIndex, imageID, textureStage ), where textureStage is UV set..


Rick Nasher

#14
@Naughty Alien: Are you trying to recreate that excellent SunFlares demo?

I was using it waaaay back to test if Blitz3D was capable of doing what I wanted it to..

I was using it waaaay back to test if Blitz3D was capable of doing what I wanted it to.. 

Made an island out of it, added dragon breathing fire particles, underwater cam, shark swimming round the island & fishes. Was great stuff to play round with.
_______________________________________
B3D + physics + shaders + X-platform = AGK!
:D ..ALIENBREED *LIVES* (thanks to Qube).. :D
_______________________________________