#not sure what you mean by that

1 messages · Page 1 of 1 (latest)

indigo leaf
#

Are you familiar with using a debugger?

versed escarp
#

no i am not

indigo leaf
#

Try using a debugger and test only for instances that break.

#

Set a breakpoint, enter debug mode, and your code will stop at the breakpoint and allow you to inspect the variable values

#

You can manually modify the values to test what works and what does not.

Also, you can just brute force adding +tileOffset one by one into each field, or -tileOffset into each field and seeing what works

versed escarp
#

yeah ive been trying lots of different ones, i tried to mirror with my logic, which worked but also mirrored the uvs again

#

let me see if i can recreate that

indigo leaf
#

It is critical to use debugging skills here

#

Brute forcing works but is very slow compared to debugging

versed escarp
#

ill look up a tutorial on how to use that. adding it on an empty line doesnt seem to work

indigo leaf
#

Consider naming the coordinates leftBottom, rightBottom, leftTop and rightTop, and using Debug.Log and breakpoints

#

This is pretty advanced stuff. It looks like you're working on recreating an engine inside of Unity.

versed escarp
#

im attempting to make a voxel terrain author, that works how i want it now. but the texturing is a waaay bigger pain than i tought:p

indigo leaf
#

I think you might have mis-labeled your points

#

Since the one change you made ended up shearing the texture by making (0, 0) and (1, 0) not actually line up on the y-axis

versed escarp
#

does u = x and v = y on the uv map?

indigo leaf
#

Yes

#

Generally speaking

versed escarp
#

then my notations of //0,1 etc are wrong

indigo leaf
#

Work on developing more robust debugging and variable names so you can ensure your label notations are correct and you can easily identify what is going wrong

#

If you don't use debugging, you can only use reasoning to determine what is wrong, and this is not as effective as actually reading the values causing the error

versed escarp
#

ill first note the correct values in the comments and then continue the tutorial on how to use the debugger. it sounds very helpfull

indigo leaf
#

Just a breakpoint & stepping through with the debugger is very powerful

versed escarp
#
                vOffset = (adjPos.y % tilingFactor) * tileSize;
            /*  uvs.Add(new Vector2(uOffset + tileSize, vOffset + tileSize));    //1,1   Top Right       
                uvs.Add(new Vector2(uOffset, vOffset + tileSize));               //0,1   Top Left  
                uvs.Add(new Vector2(uOffset, vOffset));                          //0,0   Bottom Left     
                uvs.Add(new Vector2(uOffset + tileSize, vOffset));               //1,0   Bottom Right  */   

                uvs.Add(new Vector2(uOffset, vOffset + tileSize));               //0,1   Top Left  
                uvs.Add(new Vector2(uOffset + tileSize, vOffset + tileSize));    //1,1   Top Right   
                uvs.Add(new Vector2(uOffset + tileSize, vOffset));               //1,0   Bottom Right      
                uvs.Add(new Vector2(uOffset, vOffset));                          //0,0   Bottom Left  ```

@indigo leaf  this is the result of inverting the x values, the texture gets rendered in the correct direction, but the uv's get chopped up on the vertical axis. i've used the debugger and while very handy i could not pin point the issue. i've tried brute forcing it by trying every order those 4 values could be matched in and never got close to a mapping that fits.
indigo leaf
#

I think it's floating point inaccuracy. Your code is correct, but there might be a variable fractionally off

#

Check the position values

versed escarp
#

i've been logging the adj position ( which is the position divided by scale ( 4)) and never seen a value thats not .00

#

im starting to think with this method of mapping its impossible to get the values i want in the correct order on the opposing sides, and can only be achieved by mirroring

#

the only thing i could think of to try is reversing the clockwise order of triangles for the affected sides and then try again

#

but i think that for now im sticking with the mirrored sides:p i don't think thats worth much more of my time for such a minor thing

#

@indigo leaf i do appreciate all the help though🙂

indigo leaf
#

When you perform floating point division, there is usually some tiny imprecision

versed escarp
#

i could probably make it a vector3int

indigo leaf
#

That would be a decent bet

versed escarp
#

but would that help with the division?

indigo leaf
#

It might help or hurt. If you use integer values, they would only take the first whole number of the division operation

#

1/2 = 0 since 1/2 = 0.5 and the first number is 0

#

It effectively snaps to whole numbers. It might help.

versed escarp
#

@indigo leaf i think there is some other underlying issue with the mesh, i posted about it here

versed escarp
#

remy found a solution to flipping the u ``` case Direction.West: //X- Correct
uOffset = (adjPos.z % tilingFactor) * tileSize;
vOffset = (adjPos.y % tilingFactor) * tileSize;
uvs.Add(new Vector2(-uOffset - tileSize, vOffset + tileSize));
uvs.Add(new Vector2(-uOffset, vOffset + tileSize));
uvs.Add(new Vector2(-uOffset, vOffset));
uvs.Add(new Vector2(-uOffset - tileSize, vOffset));


and the normals issue was from the tangents being incorrect