..Lightmap headache..

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

Previous topic - Next topic

markcwm

Yes, it seems textureStage is a texture 0..7 but there still seems to be only 1 uv set. Have you tried converting to OBJ?

Naughty Alien

..well..i have tried this..


for i=1 to GetObjectNumMeshes(ruin)
SetObjectMeshLightMap(ruin,i,lmp)
next


..as well as this..
SetObjectLightMap(ruin,lmp)

..but so far no luck..probably shader work is needed as you mentioned..im just not sure how to link this with default lightmap commands API has..there is no any info about this at all..

..here is what documentation says about SetObjectLightMap..so yes, its shader done thing, but automatically created..hmm

QuoteSets all meshes in this object to use the specified image as a lightmap. You can set a light map for a single mesh by using SetObjectMeshLightMap. The lightmap will be placed in texture stage 1, overwriting anything that is already there and will have a shader generated that combines it with texture stage 0, and any dynamic lighting, to correctly light the object. If you are setting your own shader with SetObjectShader then your shader will have to make use of the lightmap itself as AGK will not modify your shader in this way.

The lightmap will use the second set of UV coordinates, if available, otherwise it will use the same UV coordinates as the base texture.



markcwm

#17
Hello NA, yes you're right I should have checked that, AGK2 supports 2 sets of uv coords, the 2nd is for light or normal maps. A custom shader shouldn't be needed if the manual mentions the second uv set. There doesn't seem to be per vertex commands in AGK2 like VertexU to check this?

I found some dev info on What's New:
QuoteBuild 2.0.16
- Modified the SetObjectMeshLightMap command to use the first set of UV coordinates if a second set does not exist.
Build 2.0.15 Alpha
- .obj files no longer support a previous hack to add a second set of UV coords to the file
So it seems there is only one uv set for OBJ files, and I read this is the standard OBJ spec.

Then in the b3dfile_specs.txt there is this:
QuoteThe flags field value can conditional an additional flag value of '65536'. This is used to indicate that the texture uses secondary UV values, ala the TextureCoords command. Yes, I forgot about this one.
The flags field is an int in the TEXS chunk right after the texture filename. This flag is bit 17. The uv coords are stored in the VRTS chunk in per vertex blocks with a max of 8 uv sets and up to 4 in size but in the Blitz3d source only 2 * 2 is supported.

AGK2 uses Assimp, in the B3D loader source this TEXS flags field is ignored, instead it uses the VRTS int tex_coord_sets with a max of 4 sets. Looking at the Assimp OBJ loader source it supports 2 or 3 uvw values so a second uv set isn't possible.

Well anyway, probably the second set is there but needs assigned, SetObjectMeshImage should do that as you have tried.

Naughty Alien

Quote from: Rick Nasher on September 15, 2017, 18:32:31
@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.

...nope..im just using that sample from Gile to test lightmap pipeline in AGK..so far, no luck..lol..

Naughty Alien

..well..im happy to announce that i have managed to get lightmap work..i couldnt do much with B3D, thats left to do, but X file, i have managed to get right and it works without seams even lightmap texture is very small..now im going to take small break from this crap, and once head is clear, need to clearly set art pipeline so no issues will be for future...nasty bastard..


Steve Elliott

#20
lol, at least you're making progress now.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

MikeHart

Quote from: Naughty Alien on September 28, 2017, 13:06:11
..well..im happy to announce that i have managed to get lightmap work..i couldnt do much with B3D, thats left to do, but X file, i have managed to get right and it works without seams even lightmap texture is very small..now im going to take small break from this crap, and once head is clear, need to clearly set art pipeline so no issues will be for future...nasty bastard..



Say what? AWESOME!

RonTek

Hey finally and congrats! Btw, I think I know that scene and model.. AwingSoft Lightmap Maker, right? :)

http://www.awingsoft.com/LightMapMaker/gallery/GalleryLmm.htm



Steve Elliott

Always good to know the software - thanks RonTek.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Rooster


RonTek

Quote from: Steve Elliott on September 28, 2017, 15:37:47
Always good to know the software - thanks RonTek.

Sure thing Steve. :) I think LMM is one of the oldest GI baking tools out there, but still looks good.

Naughty Alien

..yes..i used that lightmapper (as well as one for Unity and Unreal, none worked) and exported their X ASCII(other file formats doesnt work as well) to see material/UV set matrix which AGK is happy with, so i can now actually export X directly from either 3dsmax or Gile in some stable fashion...so i needed workable ASCII format i can debug and managed to get it from that X ASCII..

RonTek

Quote from: Naughty Alien on September 29, 2017, 01:41:06
..yes..i used that lightmapper (as well as one for Unity and Unreal, none worked) and exported their X ASCII(other file formats doesnt work as well) to see material/UV set matrix which AGK is happy with, so i can now actually export X directly from either 3dsmax or Gile in some stable fashion...so i needed workable ASCII format i can debug and managed to get it from that X ASCII..

Nice. Btw, if you have tried their older DBPro and DBO file format, the lightmap loading and process is way easier. ;)

TGC have used X format with their older software before, but I'm a bit surprised they are utilizing it now with lighmapping.

Naughty Alien

...my aim is to engage FBX..i couldnt do that before because i simply had no reference to look after..so, while i could load ASCII FBX, i couldnt get its lightmap work(DAE, B3D and so on, as well)...however, now that i have workable X ascii, which i went trough already, im confident that ill be able to finally make FBX works as it should..its weird that there is no specific art pipeline guidance provided by AGK..and weird thing is that, none of supported file formats by LightmapMaker (Lightmapper i used to export 1st success X file) , except X, works..

Qube

Yay! Glad you got it working :D
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.