Corona Vray to GLB is a free script that converts either Corona Physical or Vray Materials to GLTF Materials. Download here
(For those not used to github, once you press on this link, top right corner press the three dots “…” and press Download)
Drag this toolbar button somewhere in your UI/Toolbars
Supported textures:
Diffuse/Base Color/Albedo
Roughness
Metal
Occlusion
Emission/Self Illumination
Alpha/Opacity
Normal
Clear Coat
Transmission
Sheen
Find Missing Bitmap Rules:
Bitmaps are found using the prefix as the search and suffix for the correct texture. Example: Sofa_Diffuse.png or Sofa_Albedo.png, Sofa_Roughness.png, Sofa_Normal.png etc.
Example:
Version 1.0:
This is just an alpha version to get it out into the wild, feel free to play with it, break it, give me your feedback.
If you get an error message the UI will stop working so you will have to close/re-open it. Then let me know about it.
Save your scenes before using it, undo is not always stable but you can try it (might crash with larger scenes).
You’re welcome. Basically GLTF/GLB is a real-time 3D file which allows you to embed it into webpages, some game engines also support it so its a one click import with materials instead of having to remake all the materials in the engine. Its suppose to be the ‘jpg’ of the 3D world, so anyone (including non technical people) can open your 3D file and spin it around natively on their OS, view it on their phone in VR/AR etc.
Yes the script basically has a few functions, first of all convert Corona Physical or Vray materials to GLTF Materials for 3dsmax. It can also search for textures in the directory such as Occlusion since you would have to otherwise do this manually (if you have ‘Find Missing Bitmaps’ enabled), or if you forgot to plug in some bitmaps but they are in the directory with the others as the requirement for GLB is minimum BaseColor, Rough, Metal, Occlusion, Normal. Last of all it comes with an Export button which to me is a bit more useful than the built-in exporter in 3dsmax since you have 3 options of exporting or testing.
3dsmax 2023 should have GLTF, if its not supported in your max version you will get a popup warning when running this so something else must be the issue (such as Corona Legacy material maybe).
This is just an evolution of my previous Vray to GLB script. This version now supports Corona Physical and comes with a UI. I also fixed a bunch of bugs for this one and that script is now obsolete. If you are curious about the GLTF workflow you can check out the video I made for it awhile back, it explains the ins and outs of it but obviously that script is now this one moving forward.
James, once again thank you - super helpful. I have a request - I wonder if you’d consider implementing some kind of user-friendly sandbox either within the script or as a button after everything’s exported to 1-button test the object inside a Babylon.js sandbox? This might help with quicker verification that everything has worked correctly with the materials and exports etc.
As an aside, I’m finding that I’m unable to test local babylon viewers and I’m forced to first throw it all onto my webhosting for testing - do you have the same or is there something I’m doing wrong?
alexyork, the “Export GLB File(s)” button exports your glb to your directory of choice, from there you drag/drop it into the babylon page. You shouldnt need to do any uploading to webhosting etc, I often test my exports by doing the exact same thing (as per my youtube video).
Drag and drop your .glb file here (anywhere on the page):
You can also test it locally by double clicking on the glb file and opening it in Windows 3D Viewer
Thanks so much! Somehow I’d missed that you can view these directly offline in Windows 3D Viewer - handy! I’ve been throwing them in their sandbox but that’s their own template which is nice, but for my needs I’m trying to set up a very basic template with a simple white background, which I’m defining through HTML, and loading my model into that. It works as I mentioned but only when running off the webhosting, not locally, which is odd, but I guess a limitation of how the babylon.js works.
I don’t suppose you know of any resources online for some basic templates for the viewer we can download and tweak?
This one by google has a white background (same thing, drag/drop)
Not that I know of, I use babylon, the google one and Windows 3D viewer. Between all 3 it gets the job done.
Babylon sandbox has the most amount of tools for checking technical aspects, you can also switch the background to a more grey style (bottom right corner).
Now supports all values for each texture type when not using bitmaps or color nodes (eg. roughness value of 0.75 will be copied from the material).
Supports Vray and Corona color nodes when not using bitmaps. Also if no color node and bitmap node it will use the swatch color instead.
Converts Glossiness textures to Roughness textures (slow).
Converts non-compliant textures to jpg (eg. “.tif”)
Glass to transmission - Any value used for refraction will be used as transmission
You can watch the instruction video in the first post to see how it works in action (the first post has been amended to remove redundant information and show you how to use the script).
Been using this a lot lately. Can’t thank you enough for the script and all your recent help.
A query which I hope you might be able to shed some light on…
I’m building an interactive page for model viewing. My process is to load the model using js model loader and then apply a new material (created in the js file, with a jpg texture map applied to it) to the loaded meshes. I’ve got it all working fine.
However…
If I export a mesh/model with a gltf material applied WITH a texture in the base color map and load it into my scene, all works well.
If I export a model WITHOUT a texture applied to its material the js material doesn’t seem to work properly.
I think the uv mapping is being lost in the export. Is this possible?
From my tests it seems that this is not a result of your script, but a universal particularity of gltf/glb exports.
Is there a way to export a glb/gltf without any material/textures applied but still retain the uv mapping?
Apologies for the highly specific and technical question. But, as you’ve proven, I’m certain you’re the right person to ask
I dont think so, difficult to tell without seeing the process myself however you can double check the uv’s by importing the glb into blender.
What I assume is happening is something along the lines of - without textures the id’s are blank. One of the requirements for glb files is basecolor,metal,ao,normal,rough textures (or ORM packed textures). So I assume if those are missing that channel will become ‘blank’ (instead of unassigned). Just a theory without seeing your workflow or how your js environment imports the data.
Attached an example of missing base color on a glb (when checked in windows 3d viewer)
tbh I’m trying to avoid blender (I don’t use it, and don’t want to incorporate another software into my process).
But yes, that’s what I was trying to show - it exported without UV’s. The one without UV’s was indeed exported with your script with a default gltf material (with no textures).
I do see that exporting from blender to gltf has the tickbox option to export UV mapping even when exporting with no materials/texturees. I guess we’re just missing this from Max…
You dont need to learn blender, you can just click file>import and then click the UV tab at the top, would be a fast way to just rule it out.
I have exported glb’s that use color instead of texture that work just fine but probably not in the same use case as you. The video in my first post on this thread you see me do it with glass and metal objects.
If you want just upload your 2 test glb’s I can take a look.