Wednesday, November 6, 2013

ET17 SpeedTree Import to UDK Tutorial

Now that we're done modeling the tree, our first thought would be to import it to UDK. Before anything, the tree must be put through the SpeedTree compiler which would turn the model into a file that UDK can accept. The first step for this is to save your tree on the modeler.
























SpeedTree will save your model as an .spm, a file that cannot be read by UDK, but can be used for the compiler. Next, open the compiler. 



The compiler would then open up like this. You can add your recently saved tree by going to Add Trees... and selecting your file.

You should get a window like this after selecting your tree and clicking next. This window is your Compilation Setting, where you can change the file's destination after compiling, whether or not to create billboards or a texture atlas. You can leave it as default for the purposes for this tutorial.


Once done with that, the SpeedTree Compiler Session Properties window on the left will essentially be similar to your spreadsheet in the SpeedTree modeler as it contains the many of the settings and values of your model. You can also check or uncheck certain properties you want to carry over to UDK, such as the simulated wind or the billboards.


You can start your compiling by pressing F7 or the button in the Compiler Session Properties window. You will then get a Pre-compilation Summery window which will list the output files (in which the model will be a .srt file) and the materials used in making the tree as .tga. Once you're done with checking your properties, hit Compile to export said files. Now we can head on to UDK to import them. 


Open up UDK, go to the Content Browser and select import. From there, go to wherever you saved the compiled files from the SpeedTree Compiler and select the .srt file. Name your package and hit OK.



Your file should show up as seen below and should be in a new package, this will where you will be putting your textures/ materials as well.


You can double click the SpeedTree file to view your model. However, by itself, it will appear as just the model with no materials. The tabs on the right in the window will indicate as such as the materials are not yet imported. If the tree does not appear altogether, be sure to save the package on UDK as the will show that is loaded but not saved.



Next we need to import the textures that came along with the compiled files.



The textures should come up on the content browser now. For each texture, the files that should be present are the normal file and for the leaves, the spectral file.



The textures cannot be added as they are now and must be made into materials so we can put them on the untextured tree. Right click the bark file and select Create New Material.


Double click the new material to open the Material Editor. Hold control and drag the texture box away to easier manage it.




Then connect the Texture Sample to the Diffuse tab, black to black. This adds the texture and its effects to the material. This has to be done for all textures and their normal and spectral files. Next right click the Texture Sample and go to Texture > New Texture Sample.




You will then have another texture sample, this one however, must be connected to Normal, black to black.


With that, you are done with your bark material. Save your Material Editorial by clicking the green check mark on the top of the window and exit back to the content browser. Next we will do the same for the leaves. Right click the texture and select New Material.


Open the Material Editor, and like before, connect the Texture Sample to Diffuse, black to black.



Right click and select Texture > New MeshSubUV to bring up another texture sample.

Again, connect the Texture Sample to Normal, black to black. Now unlike the bark material, we have a few more steps to take for the leaves.

Right click and go to Textures > New Scene Texture to add another texture sample to the editor.

The new texture sample is the spectral file we imported before. Connect that to the Specular tab, black to black.



We're almost done with the leaves. The material, as it is now, will show the green background instead of the leaves mask with the transparent background. To fix this, right click and go to Constants > New VertexColor.


Next, right click again, go to Math > New Add which adds another texture sample needed to make the background of the material transparent.


You should end up with these two new elements.



Then connect the top Texture Sample's white tab to Add's 'A' tab. Also connect Vertex Color's white tab to Add's 'B' tab, as shown below.



After that's done, connect Add's left black tab to OpacityMask.


We are nearly done; next click the PreviewMaterial_1 box. Look down at the bottom of the window and there should be a section under Material that says 'Blend Mode', and change that to BLEND_Masked.



Now the leaves are all done. Don't forget to click the green check mark to save the editor and exit back to the content browser. Now that we have all our materials ready, double click the .srt SpeedTree file to apply our materials to the model.



Go to each according part of the model under 'Material' and press the green arrow after you highlighted one of your materials to apply it to the corresponding part of the model. It may take a minute for UDK to load the materials onto the tree model. Once its done loading, you can close the editor and drag the file to UDK. Initially the model will come as small in scale, you can scale it up according to your liking.


Here it is, being scaled to a bigger size.





And that wraps it up. You now have your tree imported, fully textured in UDK.

References:

Provided footage and info for tutorial:
http://www.youtube.com/watch?v=jGblRGKUXSw

SpeedTree Modeler Tutorial and additional info:
http://cg.tutsplus.com/tutorials/speedtree-tutorials/speedtree-to-udk-creating-a-palm-tree-in-speedtree-and-importing-it-into-udk/

No comments:

Post a Comment