TerrainTexturing -> Incomplete LookupTable for tile texture transitions

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: TerrainTexturing -> Incomplete LookupTable for tile texture transitions

Post by Interkarma »

The bit combining to describe part of a curve with an inside/outside is definitely a hard thing to explain. I think it took me at least a couple of days just to grok what you did in a few hours. :)

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: TerrainTexturing -> Incomplete LookupTable for tile texture transitions

Post by Daniel87 »

Interkarma wrote: Wed Apr 21, 2021 9:51 pm The bit combining to describe part of a curve with an inside/outside is definitely a hard thing to explain. I think it took me at least a couple of days just to grok what you did in a few hours. :)
Well, you had to come up with it by yourself, while I can simply refer to your code and the pictures you sent me, which both were of tremendous help.

Is there a way you can conjure a simple paint sketch of the curve or a few words to explain what "shape" and "ring" stand for in that diagram?
Still struggling to wrap my head around that part.

Is it correct, that tilemapData[index] stores 8 Bits - the first is flip, the second is rotation and the last 6 Bits are the Index of the texture? (texture number)
And is it correct, that tileData[tileID] stores 8 Bits - the first four Bit representing b0-b3 of marching square diagram and the last 4 Bits represent the Cases 0 - 15 of the same diagram ?
In Julianos we Trust.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: TerrainTexturing -> Incomplete LookupTable for tile texture transitions

Post by Interkarma »

Nah, I relied heavily on lots of different sources. I'm not smart enough to invent much here, I just "Daggerfied" whatever I could wrap my head around. All the example code out there is really similar, and I'm sure you'll find better explanations than I could give you. I think this PDF is one of the better examples.

Keep in mind the marching square stuff was all built back in 2014 for DFTFU, before DFU even existed. It's not exactly fresh material for me at this point.

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: TerrainTexturing -> Incomplete LookupTable for tile texture transitions

Post by Daniel87 »

Interkarma wrote: Thu Apr 22, 2021 12:31 pm Nah, I relied heavily on lots of different sources. I'm not smart enough to invent much here, I just "Daggerfied" whatever I could wrap my head around. All the example code out there is really similar, and I'm sure you'll find better explanations than I could give you. I think this PDF is one of the better examples.

Keep in mind the marching square stuff was all built back in 2014 for DFTFU, before DFU even existed. It's not exactly fresh material for me at this point.
Thank you for the PDF, I am sure that helps a lot. Sitting with my calculator right now, calculating an example for Case 1 of the diagram haha.
Somehow I never get the right result. I guess I am misunderstanding something. I better work through the PDF rather than guessing and messing.

EDIT: I found a way to do it that is not too taxing:

I created a Array<TileObject> of tiles (lookup table) manually and search through it with Array.Find() Updating Terrain takes about 100-150ms longer per MapPixel but it should be fine.

TileObject class contains the tile (byte) and 4 int (for every corner of the marching square).
In Julianos we Trust.

Post Reply