Jump to content

How the hell do you friggin load .obj things or whatever


HatKidSoldTheirSoul

Recommended Posts

Hi

 

I just finished figuring this out myself; I loaded obj files as a block, for use by a TileEntityRenderer

Try this github branch

https://github.com/TheGreyGhost/MinecraftByExample/tree/1-15-2-working-latestMCP

 

The key files:

blockstates json:

{
  "forge_marker": 1,
  "variants": {
    "use_wavefront_obj_model=false": { "model": "block/hopper" },
    "use_wavefront_obj_model=true": { "model": "minecraftbyexample:block/mbe21_ter_wavefront_model" }
  }
}

in models/block:

{
  "loader": "forge:obj",
  "flip-v": true,
  "ambientToFullbright": false,
  "__comment": "flip-v may be required if your texture appears mirrored.  See OBJloader::read() for other flags.  currently the available options are",
  "__comment1": "detectCullableFaces (default true) = try to convert faces to Directional Quads (EAST, WEST, etc) instead of just general quads",
  "__comment2": "diffuseLighting (default false) = attempt to apply the direction-dependent lighting as per vanilla blocks.  Currently does nothing.",
  "__comment3": "flipV (default false) = mirror the texture sheet top-->bottom (if your textures appear upside-down)",
  "__comment4": "ambientToFullbright (default true) = always render at maximum world illumination (combinedLight) regardless of the actual skylight or blocklight present",
  "__comment5": "materialLibraryOverrideLocation (default null) = use this path/filename for the material library file .mtl",
  "model" : "minecraftbyexample:models/block/mbe21_ter_gem.obj"
}

obj file in same directory:

# Blender v2.80 (sub 75) OBJ File: 'mbe21_ter_gem.blend'
# www.blender.org
mtllib mbe21_ter_gem.mtl
o Gem
v 0.000000 1.000000 0.000000
v -0.500000 0.000000 -0.500000
v 0.500000 0.000000 -0.500000
v 0.500000 -0.000000 0.500000
v -0.500000 -0.000000 0.500000
v 0.000000 -1.000000 -0.000000
vt 0.125000 0.000000
vt 0.000000 0.500000
vt 0.250000 0.500000

vt 0.375000 0.000000
vt 0.250000 0.500000
vt 0.500000 0.500000

vt 0.625000 0.000000
vt 0.500000 0.500000
vt 0.750000 0.500000

vt 0.875000 0.000000
vt 0.750000 0.500000
vt 1.000000 0.500000

vt 0.125000 1.000000
vt 0.000000 0.500000
vt 0.250000 0.500000

vt 0.375000 1.000000
vt 0.250000 0.500000
vt 0.500000 0.500000

vt 0.625000 1.000000
vt 0.500000 0.500000
vt 0.750000 0.500000

vt 0.875000 1.000000
vt 0.750000 0.500000
vt 1.000000 0.500000
vn 0.0000 0.4472 -0.8944
vn 0.8944 0.4472 0.0000
vn 0.0000 0.4472 0.8944
vn -0.8944 0.4472 0.0000
vn 0.0000 -0.4472 -0.8944
vn 0.8944 -0.4472 -0.0000
vn 0.0000 -0.4472 0.8944
vn -0.8944 -0.4472 -0.0000
usemtl Material
s 1
f 1/1/1 3/2/1 2/3/1
f 1/4/2 4/5/2 3/6/2
f 1/7/3 5/8/3 4/9/3
f 1/10/4 2/11/4 5/12/4
f 6/13/5 2/14/5 3/15/5
f 6/16/6 3/17/6 4/18/6
f 6/19/7 4/20/7 5/21/7
f 6/22/8 5/23/8 2/24/8

mtl file in same directory:

# Blender MTL File: 'mbe21_ter_gem.blend'
# Material Count: 1

newmtl Material
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.0 0.0 0.0
Ni 1.450000
d 1.000000
illum 2
map_Kd minecraftbyexample:model/mbe21_ter_gem

texture file is in

textures/model

 

Cheers

  TGG

Link to comment
Share on other sites

On 3/15/2020 at 7:25 PM, TheGreyGhost said:

Hi

 

I just finished figuring this out myself; I loaded obj files as a block, for use by a TileEntityRenderer

Try this github branch

https://github.com/TheGreyGhost/MinecraftByExample/tree/1-15-2-working-latestMCP

 

The key files:

blockstates json:


{
  "forge_marker": 1,
  "variants": {
    "use_wavefront_obj_model=false": { "model": "block/hopper" },
    "use_wavefront_obj_model=true": { "model": "minecraftbyexample:block/mbe21_ter_wavefront_model" }
  }
}

in models/block:


{
  "loader": "forge:obj",
  "flip-v": true,
  "ambientToFullbright": false,
  "__comment": "flip-v may be required if your texture appears mirrored.  See OBJloader::read() for other flags.  currently the available options are",
  "__comment1": "detectCullableFaces (default true) = try to convert faces to Directional Quads (EAST, WEST, etc) instead of just general quads",
  "__comment2": "diffuseLighting (default false) = attempt to apply the direction-dependent lighting as per vanilla blocks.  Currently does nothing.",
  "__comment3": "flipV (default false) = mirror the texture sheet top-->bottom (if your textures appear upside-down)",
  "__comment4": "ambientToFullbright (default true) = always render at maximum world illumination (combinedLight) regardless of the actual skylight or blocklight present",
  "__comment5": "materialLibraryOverrideLocation (default null) = use this path/filename for the material library file .mtl",
  "model" : "minecraftbyexample:models/block/mbe21_ter_gem.obj"
}

obj file in same directory:


# Blender v2.80 (sub 75) OBJ File: 'mbe21_ter_gem.blend'
# www.blender.org
mtllib mbe21_ter_gem.mtl
o Gem
v 0.000000 1.000000 0.000000
v -0.500000 0.000000 -0.500000
v 0.500000 0.000000 -0.500000
v 0.500000 -0.000000 0.500000
v -0.500000 -0.000000 0.500000
v 0.000000 -1.000000 -0.000000
vt 0.125000 0.000000
vt 0.000000 0.500000
vt 0.250000 0.500000

vt 0.375000 0.000000
vt 0.250000 0.500000
vt 0.500000 0.500000

vt 0.625000 0.000000
vt 0.500000 0.500000
vt 0.750000 0.500000

vt 0.875000 0.000000
vt 0.750000 0.500000
vt 1.000000 0.500000

vt 0.125000 1.000000
vt 0.000000 0.500000
vt 0.250000 0.500000

vt 0.375000 1.000000
vt 0.250000 0.500000
vt 0.500000 0.500000

vt 0.625000 1.000000
vt 0.500000 0.500000
vt 0.750000 0.500000

vt 0.875000 1.000000
vt 0.750000 0.500000
vt 1.000000 0.500000
vn 0.0000 0.4472 -0.8944
vn 0.8944 0.4472 0.0000
vn 0.0000 0.4472 0.8944
vn -0.8944 0.4472 0.0000
vn 0.0000 -0.4472 -0.8944
vn 0.8944 -0.4472 -0.0000
vn 0.0000 -0.4472 0.8944
vn -0.8944 -0.4472 -0.0000
usemtl Material
s 1
f 1/1/1 3/2/1 2/3/1
f 1/4/2 4/5/2 3/6/2
f 1/7/3 5/8/3 4/9/3
f 1/10/4 2/11/4 5/12/4
f 6/13/5 2/14/5 3/15/5
f 6/16/6 3/17/6 4/18/6
f 6/19/7 4/20/7 5/21/7
f 6/22/8 5/23/8 2/24/8

mtl file in same directory:


# Blender MTL File: 'mbe21_ter_gem.blend'
# Material Count: 1

newmtl Material
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.0 0.0 0.0
Ni 1.450000
d 1.000000
illum 2
map_Kd minecraftbyexample:model/mbe21_ter_gem

texture file is in

textures/model

 

Cheers

  TGG

 

So I feel bad asking here, but I can't find anything anywhere else so I'll just ask... So I've pretty much done what's in here. The game loads with no related errors or warnings. But when I place the block down, it's completely invisible. It has a hitbox, but there's nothing there. I saw one other person with this problem but they were using 1.9 and never got a good answer. Any idea what causes this?

Link to comment
Share on other sites

1 hour ago, TheGreyGhost said:

Hi

 

Short answer is: lots of things can cause this

 

If you post a link to a github I'll fork it and see if I can find any more clues.

 

-TGG

Hey! Thanks for the reply. Took me a while to figure out, and I'm not sure I did it right, but I think I finally managed to make a repository for it:
https://github.com/HappyHippo77/Witchery2

 

Please tell me if I did something wrong! I'm pretty new to github. I also may have changed some stuff in the files since I last replied.

 

(Also: I am recreating the Witchery mod, yes. Mostly for practice and personal use, though I may publicize it if it ever gets accurate enough to the original. The idea is not to claim the work as my own, but to bring back the work of another person.)

Edited by HappyHippo77
Link to comment
Share on other sites

Ah.  You're using 1.14.  Any reason you're not using 1.15?

 

I wrestled with it for a while but I couldn't get it to load properly.  It either sticks .json on the end of the .obj filename or it doesn't load at all.  I can't figure out how the object loader is supposed to be invoked.

 

Sorry dude, unless you update to 1.15 I'm out of ideas.

 

-TGG

 

Link to comment
Share on other sites

15 hours ago, TheGreyGhost said:

Ah.  You're using 1.14.  Any reason you're not using 1.15?

 

I wrestled with it for a while but I couldn't get it to load properly.  It either sticks .json on the end of the .obj filename or it doesn't load at all.  I can't figure out how the object loader is supposed to be invoked.

 

Sorry dude, unless you update to 1.15 I'm out of ideas.

 

-TGG

 

I might be able to figure it out in 1.15. I used 1.14 because the documentation sucks for 1.15, and there's no tutorials for it either. I'll see if I can update.

Link to comment
Share on other sites

In your material file you need to update the path for the .png file. It should be a path to a file in the textures directory. Which I see you have already copied the file there.

I.E update the line in the .mtl file to:

map_Kd witchery2:block/witchs_cauldron

 

Also the path in the .json model must be a full path, from the root of your mod. (this is probably the main problem for you)

So make the path:

"model" : "witchery2:models/block/witchs_cauldron.obj"

Adding the "models/" to the start.

 

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

    • LOGIN DAN DAFTAR DISINI CEPAT!! AYUTOGEL adalah situs judi online yang memudahkan para pemainnya, dengan menggunakan deposit pulsa terbilang cukup memudahkan para pemainnya dikarenakan setiap orang pasti bisa mengisi pulsa di mana pun dengan agen agen pulsa, dengan mudah di dapat kan dimana mana jika para pemain tidak memiliki e-money atau m-banking anda tidak perlu khawatir lagi di karenakan AYUTOGEL adalah situs slot deposit pulsa. Slot Deposit pulsa adalah sebuah situs judi slot online yang melayani deposit menggunakan transfer pulsa atau menggunakan pulsa ponsel yang tersedia.
    • DAFTAR DAN LOGIN DISINI   Hantogel atau handogel adalah bentuk pengumpulan duka uang yang populer di dunia judi online, khususnya dalam permainan slot gacor. Banyak situs judi online yang menawarkan handogel slot gacor, dan sebagai pemain, penting untuk mengetahui cara memilih dan mengakses situs tersebut dengan aman dan amanah. Dalam artikel ini, kami akan membahas cara memilih situs slot gacor online yang berkualitas dan tahu cara mengakses handogelnya.
    • DAFTAR & LOGIN SIRITOGEL Siritogel adalah kumpulan kata yang mungkin baru saja dikenal oleh masyarakat, namun dengan perkembangan teknologi dan banyaknya informasi yang tersedia di internet, kalau kita siritogel (mencari informasi dengan cara yang cermat dan rinci) tentang situs slot gacor online, maka kita akan menemukan banyak hal yang menarik dan membahayakan sama sekali. Dalam artikel ini, kita akan mencoba menjelaskan apa itu situs slot gacor online dan bagaimana cara mengatasi dampaknya yang negatif.
    • This honestly might just work for you @SubscribeEvent public static void onScreenRender(ScreenEvent.Render.Post event) { final var player = Minecraft.getInstance().player; final var options = Minecraft.getInstance().options; if(!hasMyEffect(player)) return; // TODO: You provide hasMyEffect float f = Mth.lerp(event.getPartialTick(), player.oSpinningEffectIntensity, player.spinningEffectIntensity); float f1 = ((Double)options.screenEffectScale().get()).floatValue(); if(f <= 0F || f1 >= 1F) return; float p_282656_ = f * (1.0F - f1); final var p_282460_ = event.getGuiGraphics(); int i = p_282460_.guiWidth(); int j = p_282460_.guiHeight(); p_282460_.pose().pushPose(); float f5 = Mth.lerp(p_282656_, 2.0F, 1.0F); p_282460_.pose().translate((float)i / 2.0F, (float)j / 2.0F, 0.0F); p_282460_.pose().scale(f5, f5, f5); p_282460_.pose().translate((float)(-i) / 2.0F, (float)(-j) / 2.0F, 0.0F); float f4 = 0.2F * p_282656_; float f2 = 0.4F * p_282656_; float f3 = 0.2F * p_282656_; RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); p_282460_.setColor(f4, f2, f3, 1.0F); p_282460_.blit(new ResourceLocation("textures/misc/nausea.png"), 0, 0, -90, 0.0F, 0.0F, i, j, i, j); p_282460_.setColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.defaultBlendFunc(); RenderSystem.disableBlend(); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); p_282460_.pose().popPose(); }   Note: Most of this is directly copied from GameRenderer as you pointed out you found. The only thing you'll have to likely do is update the `oSpinningEffectIntensity` + `spinningEffectIntensity` variables on the player when your effect is applied. Which values should be there? Not 100% sure, might be a game of guess and check, but `handleNetherPortalClient` in LocalPlayer has some hard coded you might be able to start with.
    • Dalam dunia perjudian online yang berkembang pesat, mencari platform yang dapat memberikan kemenangan maksimal dan hasil terbaik adalah impian setiap penjudi. OLXTOTO, dengan bangga, mempersembahkan dirinya sebagai jawaban atas pencarian itu. Sebagai platform terbesar untuk kemenangan maksimal dan hasil optimal, OLXTOTO telah menciptakan gelombang besar di komunitas perjudian online. Satu dari banyak keunggulan yang dimiliki OLXTOTO adalah koleksi permainan yang luas dan beragam. Dari togel hingga slot online, dari live casino hingga permainan kartu klasik, OLXTOTO memiliki sesuatu untuk setiap pemain. Dibangun dengan teknologi terkini dan dikembangkan oleh para ahli industri, setiap permainan di platform ini dirancang untuk memberikan pengalaman yang tak tertandingi bagi para penjudi. Namun, keunggulan OLXTOTO tidak hanya terletak pada variasi permainan yang mereka tawarkan. Mereka juga menonjol karena komitmen mereka terhadap keamanan dan keadilan. Dengan sistem keamanan tingkat tinggi dan proses audit yang ketat, OLXTOTO memastikan bahwa setiap putaran permainan berjalan dengan adil dan transparan. Para pemain dapat merasa aman dan yakin bahwa pengalaman berjudi mereka di OLXTOTO tidak akan terganggu oleh masalah keamanan atau keadilan. Tak hanya itu, OLXTOTO juga terkenal karena layanan pelanggan yang luar biasa. Tim dukungan mereka selalu siap sedia untuk membantu para pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Dengan respon cepat dan solusi yang efisien, OLXTOTO memastikan bahwa pengalaman berjudi para pemain tetap mulus dan menyenangkan. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi pilihan utama bagi jutaan penjudi online di seluruh dunia. Jika Anda mencari platform yang dapat memberikan kemenangan maksimal dan hasil optimal, tidak perlu mencari lebih jauh dari OLXTOTO. Bergabunglah dengan OLXTOTO hari ini dan mulailah petualangan Anda menuju kemenangan besar dan hasil terbaik!
  • Topics

×
×
  • Create New...

Important Information

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