ScreteMonge / creators-kit

BSD 2-Clause "Simplified" License
4 stars 1 forks source link

Cannot load blender model #4

Closed TayIorSwift closed 6 months ago

TayIorSwift commented 6 months ago

In the Model Organiser there's an option to load a model exported from blender, I've tried exporting in Obj, Fbx, Stl and even just using the .blend file itself, the error I recieve is

Failed to find blender file. Exception: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 3 column 1 path $

am I misunderstanding how this feature should work or is this feature not working?

ScreteMonge commented 6 months ago

This feature isn't really for public use yet, as while I can import static models, they do not animate well.

There's a specific string of code that's used in Blender to turn the obj into a usable file. I haven't made it public due to the above and the confusion/frustration it might cause for the average user if their imported model doesn't animate.

If you're interested, I'd be willing to share it, just know it has quite a few limitations at this time.

Also, it might be easier to reach me through discord, as I don't watch github too closely. https://discord.gg/DSpPfC2Ebh

TayIorSwift commented 6 months ago

Would love to get a quick rundown on how you turn it into a usable file animations arent so important for me, I've joined your discord for any future inquiries

ScreteMonge commented 6 months ago

Blender Export 3.txt

Here's a file with the appropriate code. Copy all the text within, then in Blender, open the Python Console editor and paste it there.

Update

This program is now available as an installable plugin.

Blender To RS.txt

Download this .txt file and resave it as a .py file. Throw it wherever you feel/wherever you can find it again. Open Blender, go Edit -> Preferences -> Add-ons -> click Install and select this .py file -> click Install Add-on -> toggle it on in the Add-ons menu.

To use it, select the object you want to export and hit Ctrl + Shift + E. It should open a dialogue prompt asking where to save the json file. You can save it anywhere, but Creator's Kit will automatically search for C:\Users\YourName\.runelite\creatorskit\blender-models so I always save it there.

Couple more instructions for future reference:

1) Animations do not work on imported Blender models

2) You cannot use Blender 4.0 and later versions

3) The only material types used should be Principled BDSF. You may use the Alpha factor to apply transparency to the model

4) Make sure the model you're importing is only composed of triangles, no other polys. Add and Apply the Triangulate modifier if you're unsure if your model is only triangles

5) You may have to recalculate normals because Java only renders faces on one side, unlike Blender (switch to Edit mode, select the faces that are inverted/backwards, hit Ctrl + Shift + N to recalculate normals).

6) Runescape's scale is way, way larger than what you're used to in Blender. You may have to scale up your models by 100x for them to be visible in-game (and remember to go Ctrl + A and hit Apply All Transforms after scaling)