April 02, 2020, 11:10:24 AM

Author Topic: progressive transition between 2 different lightmaps (texels lighting / shading)  (Read 618 times)

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1039
hi,

the cold days are coming, so i was in the mood to re-play one of my favourite game : Thief 1/2 (the dark project and the metal age). the gameplay in these games is very good and refined compared to the last recent one...
youtube.com/watch?v=fL_xuKEPpDg

the graphics style is mostly made of low detail shapes colored with diffuse textures, and some precalculated texels lighting shading ("lightmapping").

the originality of this game is that each "room" has been lightmapped as dark (when no lightsource is on) and as lighted (when one or several lightsources are on)
and this allows some cool gameplay mechanics like puting (fire) lightsources out with "water arrows".

anyway what i have never seen in any other game is a progressive transition from one lightmap to the other. not sure how they are doing that ?

i will try to post a video capture to show you what i mean...
here :
youtube.com/watch?v=0nope2aevJU&t=6m21s (at 6m21s)
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline 3DzForMe

  • Hero Member
  • *****
  • Posts: 931
@REmiD, yeah, I loved the atmosphere in the original Thief - somehow they failed to capture the immersive-ness in the later editions.

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1039
the rope arrow (that you can shoot on wood surfaces and then climb on the rope) is a really good gameplay idea. ;D


but anyway, my post was more about how to achieve this progressive change between 2 lightmaps applied on the same surface(s)

maybe they used a temporary texture to progresively change the alpha (or color) of each texel (since the texel size i rather big, the number of texels in a texture is quite low compared to modern games)
for example for a 7w3h7d room, with a texel size of 0.1unit it would be :
floor : 70x70
wall : 70x30 (x4)
ceiling : 70x70
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Kryzon

  • Full Member
  • ***
  • Posts: 193
With shaders you can define exactly how all those colors should be blended, right? The lightmap texture, the diffuse texture etc.

But that Thief game there seems to be old, using fixed-function graphics. I would guess that this lighting effect is done by animating vertex colors - the fixed-function compositing process works like vertexColor x texture1 x texture2 etc. (with texture1 = lightmap-shade-texture and texture2 = diffuse color texture).
The vertex colors then can animate from black to white to make the room go from black to whatever it should be, when lit.

There are alternative ways to do this: the environment mesh has 3 UV channels, one for the diffuse texture, one for the lightmap shade texture and another that's all vertices collapsed on the same point.
This third UV channel is used with a gradient texture, you scroll the UVs of that third channel horizontally so that it samples the gradient and causes the mesh to "transition" from, say, black to white. In most engines this'd be done with a texture matrix, in Blitz3D this is done with the high-level function PositionTexture().

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1039
Quote
that Thief game there seems to be old
released in 1998


Quote
I would guess that this lighting effect is done by animating vertex colors - the fixed-function compositing process works like vertexColor x texture1 x texture2 etc. (with texture1 = lightmap-shade-texture and texture2 = diffuse color texture).
i thought about that, however in the video, you can see that there are several rooms, and several lightsources, (one lightsource per room to simplify) and when you go in a room, the room is lighted and the others neighboor rooms are "darked", but not only lighting and shading, but also projected shadow (on texels, so "lightmapping")

however, what i don't understand is that each room seem to be textured with 1 diffuse texture and several lightmap textures for this progressive transition to be made. it is not only about lighting and shading but also lights and shadows projected in the active room and the neigboor rooms...
so i don't think vertex color / alpha is used, my guess is that since the progressive transition only happens in the active room and the neighboor rooms, and since the texel size is quite big (0.1unit or more), the number of texels in each lightmap texture is quite low, and so my guess was that it could be a procedural blend of several lightmap textures to produce one final lightmap texture... (or several lightmap textures, one for each room)


Quote
This third UV channel is used with a gradient texture, you scroll the UVs of that third channel horizontally so that it samples the gradient and causes the mesh to "transition" from, say, black to white.
can't be, the shadows are also progressively appearing / disappearing and projected in the neighboor rooms.


my opinion is that the guys who have coded this effect, with the technology they had, are really really good.  8)
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1039
Quote
The vertex colors then can animate from black to white to make the room go from black to whatever it should be, when lit.
Quote
the environment mesh has 3 UV channels, one for the diffuse texture, one for the lightmap shade texture and another that's all vertices collapsed on the same point.
This third UV channel is used with a gradient texture, you scroll the UVs of that third channel horizontally so that it samples the gradient and causes the mesh to "transition" from, say, black to white
after a closer look, i think that you are right, one or the other method you mentionned is most likely used to achieve this progressive transition because when the light is fully on, i can still see the black (now light grey) texels of the shadows areas...
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Kryzon

  • Full Member
  • ***
  • Posts: 193
This is really only a problem if you're using Blitz3D or OpenB3D, as they use the fixed-function graphics. 
Once you have something like Unity that lets you program shaders, this kind of thing is easily done with some multiplications of an animated variable (called a "Uniform") that's sent to the shader. 

As a proof of concept, some genious even tried lightmapping in real-time (click and drag mouse): https://www.shadertoy.com/view/MttSWS

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal