Sunday, December 8, 2019

Unreal Engine: Scene Construction

Right at the start of the project when I first created the basic block-out of the Gqs Staion, I imported the model into Unreal Engine 4 so I could walk around and get a feel for size. Now I am bringing the file build back into the engine as it will have the strength and processing power needed to render out our scene. Feels funny to have come somewhat full circle. We currently have a tutor from China in the class and his knowledge and expertise in the engine has been invaluable to making the import work









One issue I did come across while testing the various assets in the scene is anything that has more than 1 texture tile needs to either be UVed again to put all the textures on 1 tile or be split up into the relevant parts. In the case of the Robot and Mouse, both these assets have multiple textures tiles and the fact there is animation applied means they can not be split up into multiple pieces. Both Robot and Mouse will need to be re-UVed and re-textured to correct this.

Part of the process that still required Maya was that all the objects being imported into the scene had to be smoothed as Unreal triangulates all the faces of the object so no extra smoothing can occur. To do this quickly I set up a couple of simple custom buttons in Maya using MEL coding.

I had originally added a Vray Subdiv node to each object so my first piece of code was an adaption of one I found online which would remove the Subdiv function.

"
import maya.cmds as cmds
import maya.mel as mel

def makeVrayAttributes(startID=1):
    sel = cmds.ls(sl=1)
    currentID=startID
    for i in sel:
        # get renderable shape nodes relative to transform, iterate through and apply subdivision
        shapes = cmds.listRelatives(i,s=1,ni=1)
        if shapes:
            for s in shapes:
                melCmd = "vray addAttributesFromGroup "+s+" vray_subdivision 1"
                mel.eval(melCmd)
                melCmd = "vray addAttributesFromGroup "+s+" vray_subquality 1"
                mel.eval(melCmd)
        # apply object ID to xform. i don't like giving individual shapes IDs.
        melCmd = "vray addAttributesFromGroup "+i+" vray_objectID 1"
        mel.eval(melCmd)
        cmds.setAttr(i+'.vrayObjectID',currentID)
        currentID += 1

makeVrayAttributes()
"

'SmoothPolygon;' would smooth the currently selected object
'Export "OBJexport";' would export the currently selected object as an OBJ format

Having both these buttons on my top bar greatly reduced my time clicking around the screen so I can increase my productivity

No comments:

Post a Comment