June 27, 2019, 10:26:40 AM

Author Topic: ..Lightmap headache..  (Read 3691 times)

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 390
Re: ..Lightmap headache..
« Reply #15 on: September 15, 2017, 10:46:15 PM »
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?

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 591
Re: ..Lightmap headache..
« Reply #16 on: September 16, 2017, 02:53:57 AM »
..well..i have tried this..

Code: [Select]
for i=1 to GetObjectNumMeshes(ruin)
SetObjectMeshLightMap(ruin,i,lmp)
next

..as well as this..
Code: [Select]
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

Quote
Sets 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.



Offline markcwm

  • Sr. Member
  • ****
  • Posts: 390
Re: ..Lightmap headache..
« Reply #17 on: September 16, 2017, 06:25:02 AM »
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:
Quote
Build 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:
Quote
The 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.

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 591
Re: ..Lightmap headache..
« Reply #18 on: September 16, 2017, 12:38:44 PM »
@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..

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 591
Re: ..Lightmap headache..
« Reply #19 on: September 28, 2017, 01:06:11 PM »
..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..


Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 1809
Re: ..Lightmap headache..
« Reply #20 on: September 28, 2017, 02:41:05 PM »
lol, at least you're making progress now.
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.1, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).

Offline MikeHart

  • Hero Member
  • *****
  • Posts: 586
  • Cerberus-X Dev Team
    • Cerberus X
Re: ..Lightmap headache..
« Reply #21 on: September 28, 2017, 03:15:53 PM »
..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!

Offline RonTek

  • Sr. Member
  • ****
  • Posts: 357
Re: ..Lightmap headache..
« Reply #22 on: September 28, 2017, 03:32:15 PM »
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



Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 1809
Re: ..Lightmap headache..
« Reply #23 on: September 28, 2017, 03:37:47 PM »
Always good to know the software - thanks RonTek.
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.1, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).

Offline Rooster

  • Sr. Member
  • ****
  • Posts: 358
  • I don't know what this does...
Re: ..Lightmap headache..
« Reply #24 on: September 28, 2017, 04:28:18 PM »
Way to go NA!

Offline RonTek

  • Sr. Member
  • ****
  • Posts: 357
Re: ..Lightmap headache..
« Reply #25 on: September 29, 2017, 01:35:48 AM »
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.

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 591
Re: ..Lightmap headache..
« Reply #26 on: September 29, 2017, 01:41:06 AM »
..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..

Offline RonTek

  • Sr. Member
  • ****
  • Posts: 357
Re: ..Lightmap headache..
« Reply #27 on: September 29, 2017, 01:52:45 AM »
..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.

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 591
Re: ..Lightmap headache..
« Reply #28 on: September 29, 2017, 01:59:14 AM »
...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..

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1927
Re: ..Lightmap headache..
« Reply #29 on: September 29, 2017, 02:00:28 AM »
Yay! Glad you got it working :D
Until the next time...