Jump to content

1.15 Model rotation messes with UVs


Muramasa

Recommended Posts

So I'm having trouble baking a model with a rotation matrix. I am trying to create an IModelTransform given an array of Direction as shown here: https://pastebin.com/MjzAHeK9 However while the vertex data seems to be correctly rotated, the uvs are all wrong. I'm really not sure what I could be doing wrong as shown here: https://i.imgur.com/z6dcXBb.png

Edited by Muramasa
unsolved
Link to comment
Share on other sites

I am trying to implement pipes. I have a model for every unique "shape", and when baking each of those shapes, I'm adding every rotation combination needed to a master map to return in my baked model. Even just rotation some shapes by 90 degrees messes with the UVs totally.

Link to comment
Share on other sites

Use a multipart model/blockstate is the easiest way to do it:

https://minecraft.gamepedia.com/Model#Block_states

 

Look at how the fence blockstate is defined (client-extra.jar) for an example, and just rotate about the other axis for up/down.

That way you only need a couple of models for all permutations, and don't need a custom baked model.

See mine (wire, has multiple states for each side so is somewhat complicated, but you can just look at the basic structure):

Blockstate file:

https://github.com/Alpvax/AdvancedAutocrafting/blob/1.15/src/generated/resources/assets/advancedautocrafting/blockstates/wire.json

One of the model files (wire_arm is currently just base_wire_arm, but with a texture):

https://github.com/Alpvax/AdvancedAutocrafting/blob/1.15/src/generated/resources/assets/advancedautocrafting/models/block/part/base_wire_arm.json

 

For reference, my wire blockstate has an enum property for each direction (NONE, CONNECTED, INTERFACE, DISABLED) and each state shows something different ("arm"s are visible for both connected and interface, hence the | in the "when" json value.

I would not recommend actually looking at my WireBlock code, it is overly complicated due to some experimentation I was doing with data generation and general messing around).

 

Attached image for end result (before disabled got its own model).

2020-01-30_17.48.38.png

Edited by Alpvax
More info on my usage.
Link to comment
Share on other sites

I really appreciate the detailed response, but I can't go down the vanilla multipart route as I also need to implement covers, side culling and user disable-able connections. I feel like this is way too much to hold in a blockstate. Maybe I could use the vanilla rotations tho

 

However this still highlights the issue that rotating UVs in code seems to be broken, unless I'm doing something wrong, but I don't know what that could be.

Edited by Muramasa
Link to comment
Share on other sites

Here is my model class

 

DynamicModel is just a integer configuration map (dependant on connection state) to baked model that is returned in DynamicBakedModel. When baking the model states, I pass a direction array, which multiples a transform matrix in 90 degree increments.

Edited by Muramasa
Link to comment
Share on other sites

Hi

I think SimpleModelTransform is not suitable for what you're trying to do.  I suspect you need one which lets you control isUvLock().  You could play around with Variant to see if it does what you want, or you could dig into the Forge/Vanilla code to see what is does when loading vanilla blocks which get rotated.

-TGG

Link to comment
Share on other sites

I have solved the issue. It seems there was some weirdness when transforming the matrix in 90 degree increments. Passing a TransformationMatrix with hardcoded vector rotations did not produce incorrect UVs. I guess it was my fault? I'm not sure.. I don't know if multiplying a matrix rotation in 90 degree increments is incorrect or not.

 

Thank you everyone for your help

Edited by Muramasa
Link to comment
Share on other sites

So I may of been too quick to class this as solved. It seems my initial strategy of rotating the matrix in 90 degree increments worsened the problem, but the issue still exists. It only happens on models that have more than one quad (and uv) per face

Edited by Muramasa
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Sonic77 adalah pilihan tepat bagi Anda yang menginginkan pengalaman bermain slot yang unggul dengan akun pro Swiss terbaik. Berikut adalah beberapa alasan mengapa Anda harus memilih Sonic77: Slot Gacor Terbaik Kami menyajikan koleksi slot gacor terbaik dari provider terkemuka. Dengan fitur-fitur unggulan dan peluang kemenangan yang tinggi, Anda akan merasakan pengalaman bermain yang tak terlupakan. Akun Pro Swiss Berkualitas Kami menawarkan akun pro Swiss yang berkualitas dan terpercaya. Dengan akun ini, Anda dapat menikmati berbagai keuntungan eksklusif dan fasilitas premium yang tidak tersedia untuk akun reguler.
    • SV388 SITUS RESMI SABUNG AYAM 2024   Temukan situs resmi untuk sabung ayam terpercaya di tahun 2024 dengan SV388! Dengan layanan terbaik dan pengalaman bertaruh yang tak tertandingi, SV388 adalah tempat terbaik untuk pecinta sabung ayam. Daftar sekarang untuk mengakses arena sabung ayam yang menarik dan nikmati kesempatan besar untuk meraih kemenangan. Jelajahi sensasi taruhan yang tak terlupakan di tahun ini dengan SV388! [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]] [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]]   JURAGANSLOT88 SITUS JUDI SLOT ONLINE TERPERCAYA 2024 Jelajahi pengalaman judi slot online terpercaya di tahun 2024 dengan JuraganSlot88! Sebagai salah satu situs terkemuka, JuraganSlot88 menawarkan berbagai pilihan permainan slot yang menarik dengan layanan terbaik dan keamanan yang terjamin. Daftar sekarang untuk mengakses sensasi taruhan yang tak terlupakan dan raih kesempatan besar untuk meraih kemenangan di tahun ini dengan JuraganSlot88 [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]] [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]]
    • Slot Bank MEGA atau Daftar slot Bank MEGA bisa anda lakukan pada situs WINNING303 kapanpun dan dimanapun, Bermodalkan Hp saja anda bisa mengakses chat ke agen kami selama 24 jam full. keuntungan bergabung bersama kami di WINNING303 adalah anda akan mendapatkan bonus 100% khusus member baru yang bergabung dan deposit. Tidak perlu banyak, 5 ribu rupiah saja anda sudah bisa bermain bersama kami di WINNING303 . Tunggu apa lagi ? Segera Klik DAFTAR dan anda akan jadi Jutawan dalam semalam.
    • ladangtoto situs resmi ladangtoto situs terpercaya 2024   Temukan situs resmi dan terpercaya untuk tahun 2024 di LadangToto! Dengan layanan terbaik dan keamanan yang terjamin, LadangToto adalah pilihan utama untuk penggemar judi online. Daftar sekarang untuk mengakses berbagai jenis permainan taruhan, termasuk togel, kasino, dan banyak lagi. Jelajahi sensasi taruhan yang tak terlupakan dan raih kesempatan besar untuk meraih kemenangan di tahun ini dengan LadangToto!" [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]] [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]]
    • WINNING303 DAFTAR SITUS JUDI SLOT RESMI TERPERCAYA 2024 Temukan situs judi slot resmi dan terpercaya untuk tahun 2024 di Winning303! Daftar sekarang untuk mengakses pengalaman berjudi slot yang aman dan terjamin. Dengan layanan terbaik dan reputasi yang kokoh, Winning303 adalah pilihan terbaik bagi para penggemar judi slot. Jelajahi berbagai pilihan permainan dan raih kesempatan besar untuk meraih kemenangan di tahun ini dengan Winning303 [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]] [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]]
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.