Skip to content

Instantly share code, notes, and snippets.

@quixeltools
Last active November 14, 2019 07:49
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save quixeltools/6766c12dd1eb0088fc0ce74af1ab0735 to your computer and use it in GitHub Desktop.
Save quixeltools/6766c12dd1eb0088fc0ce74af1ab0735 to your computer and use it in GitHub Desktop.

#Quixel Megascans Scripting Reference ###Updated: Aug 19th, 2016

The Megascans Bridge allows the user to send assets from the Bridge to external applications. The Bridge currently supports the following tools:

  • 3DS Max
  • Marmoset Toolbag 2
  • Unity 3d
  • Unreal Engine 4

Support for the following tools is in development.

  • Maya
  • Modo

The Bridge comes with default scripts for the above mentioned tools. These can be used as reference to create new scripts or be used as provided.

###BRIDGE keywords

The Bridge is designed to allow users to write their own scripts. Keywords have been assigned to maps that the user can include in their scripts.

The following keywords are currently being used:

  • %%ALBEDO%%
  • %%DIFFUSE%%
  • %%AO%%
  • %%GLOSS%%
  • %%GLOSSBLINN%%
  • %%BUMP%%
  • %%NORMAL%%
  • %%NORMAL_BUMP%%
  • %%DISPLACEMENT%%
  • %%REFLECTION%%
  • %%SPECULAR%%
  • %%OPACITY%%
  • %%TRANSLUCENCY%%
  • %%ROUGHNESS%%
  • %%FUZZ%%
  • %%CAVITY%%
  • %%METALNESS%%
  • %%OBJ_PATH%%
  • MAT_%%MAT_NAME%%

##BRIDGE Scripting Format

The Bridge follows a specific convention for scripting. The first line starts with ‘--tool:’ followed by the tool name. The second line starts with ‘--name:’ followed by the script name. The third line starts with ‘--type:’ followed by the asset type (surface, 3d or atlas).

Here is an example of how a script for 3DS Max begins.

--tool:3dsmax
--name:Send to Vray(3d)
--type:3d

The following is the list of supported tools as recognized by the Bridge.

  • 3DS Max
  • Unreal Engine 4
  • Marmoset Toolbag 2

Note: Sending to Unity3d does not require a script.

###BRIDGE Scripting Examples

The Bridge contains sample scripts that can be used as reference to write custom scripts. ####3DS Max A user wanting to import a mesh in 3DS Max will write a script given below and save it in msb_Data/Support/Scripts/Max folder.

--tool:3dsmax
--name:Import Mesh
--type:3d

ImportFile "%%OBJ_PATH%%" #noPrompt

%%OBJ_PATH%% will be replaced by the path of the asset obj/fbx file that the user has selected.

Similarly if a user wishes to create a new material they can do the following:

--tool:3dsmax
--name:Create Material
--type:surface

new_baked_material = VRayMtl()
new_baked_material.name = ("MAT_%%MAT_NAME%%")
new_baked_material.brdf_type = 1
new_baked_material.texmap_diffuse = compositeTextureMap()
new_baked_material.texmap_diffuse.add();
new_baked_material.texmap_diffuse.mapList[1] = VRayHDRI()
new_baked_material.texmap_diffuse.mapList[1].HDRIMapName = ("%%ALBEDO%%")
new_baked_material.texmap_diffuse.mapList[2] = Bitmaptexture fileName: ("%%CAVITY%%")
meditMaterials[activeMeditSlot] = new_baked_material
activeMeditSlot = activeMeditSlot + 1

%%ALBEDO%% will be replaced by the path of the asset albedo map that the user has selected and %%CAVITY%% will be replaced by the path of the asset cavity map.

####Marmoset TB2

--tool:marmoset
--name:Metalness gloss 3d
--type:3d

@Sub SRSubdivision = SRSubdivisionFlatTessellation = 2048
@End

@Sub SRAlbedo = SRAlbedoMap
    Albedo Map = @Tex file "%%ALBEDO%%" srgb 1 filter 1 mip 1 aniso 4 wrap 1 @EndTex
    Color = 1 1 1
@End

@Sub SRSurface = SRSurfaceNormalMap
    Normal Map = @Tex file "%%NORMAL%%" srgb 0 filter 1 mip 1 aniso 4 wrap 1 @EndTex
    Scale & Bias = 1
    Flip X = 0
    Flip Y = 0
    Flip Z = 0
    Object Space = 0
@End
@Sub SRMerge = SRMerge
@End

%%ALBEDO%% will be replaced by the path of the asset albedo map that the user has selected and %%NORMAL%% will be replaced by the path of the asset normal map.

####Unreal Engine 4

--tool:unreal
--name:Send to Unreal(3d)
--type:3d
%%ALBEDO%%
%%NORMAL%%
%%OBJ_PATH%%
%%SPECULAR%%
%%DISPLACEMENT%%
%%GLOSS%%
%%NORMALBUMP%%
%%BUMP%%
%%ROUGHNESS%%
%%CAVITY%%

List of maps to send to the Quixel Unreal Plugin.

@Rahul73255
Copy link

Can you Help me out please
i am working on Quixel Megascan But i am not able to bake material in vray.
capture

@Rahul73255
Copy link

helpp

@jojizaidi
Copy link

Updating your Vray installation should fix this.

@ALIVEStudios
Copy link

Hi everyone. When I export to VRAY from bridge its putting every texture into a VRAY HDRI. Can someone help please. Thanks heaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment