Rendering Weapon Models for Spriting Purposes

Handy guides on how to do things, written by users for users.
Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.

Rendering Weapon Models for Spriting Purposes

Postby Minigunner » Mon Jun 27, 2016 12:04 pm

Last week I made a complaint post about an abundance of poor-quality model rips, and I later stated that I might start a tutorial on better quality model rips, so here we are.
This tutorial will be using Blender, which I have used for several rips as well as models, and the model I will be doing is the Super Shotgun from Doom 3: Resurrection of Evil. I will be linking to the Blender Manual for certain things, and even then, it's worth checking out the manual.

1) Convert the model to a usable format.
While Blender does have addons for .MD5 import/export, they are outdated and don't work with the latest versions. Instead of puckering around with an older build of Blender, I use Noesis to export the format (and plenty other formats as well) into, well, in this case the Collada .dae format (with the UV coords y-flipped).
Image
Unfortunately, Noesis does not apply .md5anim animations to the model or textures to the material (at least as far as I know), so that would have to be manually done. I personally don't need the animations because I'll be doing my own.

2) Import the model into Blender.
Pretty self-explanatory. Open Blender, then (if you don't have a custom startup file), delete the cube object that shows by default by right-clicking to select it and hitting Delete. Then go to File -> Import -> (in this case) Collada (Default) .dae.
Image
Any additional meshes you don't need to use (such as the arms and muzzle flash here) can be hidden from both preview and render by disabling the appropriate preview (Eye icon) and render (Camera icon) buttons to the right of the objects in the top-right list.

3) Adjust the model and camera to the desired positions.
The model you import might be rotated, either at an integral of 90 degrees, or worse, rotated and/or moved off-axis a bit. You can drag the model with the right mouse button (left-click afterwards to confirm transformation, right to cancel), and The Transform orientations on the right side can be used to align the model as closely to an axis as possible. It helps to change the view orientation using the keypad buttons (5 toggles a flat "orthographic" view, 1 is front, 3 is side, 7 is top, and 9 is bottom).
When adjusting the camera (the pyramid-shaped object in the above screenshot), you can view through the camera by pressing 0 on the keypad. It's also important to set the camera's FOV; go to the Object Data tab (the film camera icon above where the Transform coords are), change the "Millimeters" to "Field of View", then put in the desired FOV. It is also possible to shift the camera left/right or up/down if you want to make the weapon taller or more widescreen-friendly.
Another nifty feature is Background Images. You can use an image to help you align the model and camera together. Press N to open an inner dock on the right and you should see Background Images if you scroll down. Press "Add Image", and the rest is self-explanatory.
Image
Probably worth noting the Aspect Ratio is 1:1.2 with a 16:10 resolution; also the SSG graphic is on a 320x200 canvas.

4) Set the Materials.
Time to give the bland model some texture. Select the model and go to the Materials tab (the checkerboarded sphere icon) and create a new material if there isn't one already. Then, change the diffuse color to full-white and the intensity to 1.0, as well as set the specular intensity to 1.0 and hardness to whatever value best represents the type of material the weapon (part) consists of. Also, set the view mode (to the right of where you see "Object Mode") to Material. The model may be dark due to the lighting, but that will be covered later.
Go to the next tab, which is Textures (the checkerboard square icon). Create a new texture, and the texture type should be "Image or Movie" by default. Scroll down to the Image dropdown and click Open to import the model's Diffuse texture (generally suffixed "_d" or "_diff" in the filename). Hopefully the texture lines up with the model's UV map; this is why I mentioned flipping the UV coordinates earlier on Noesis export.
Scroll down in the texture settings to the Influence dropdown. These set how the texture affects the material. By default, the Diffuse Color influence is set at full intensity, which is right for the diffuse texture. Do the same with the Specular texture (suffixed with "_s" or "_spec"), and set the influence to Specular color. With those settled, then comes the fun part: the Normal and Bump maps.
The Bump maps (suffixed "_h" or "_bump") are simple though; however, the Color Space setting in the Image dropdown should be set to Non-Color, the Influence to Normal, and the Bump Mapping to Best Quality. The Normal maps (suffixed "_n", or "_local" in the case of Doom 3) require you to check the Normal Map box in the Image Sampling dropdown. The influence is also set to Normal.
Image
The model's all set up for rendering!
...except for one thing. It looks kinda dull. You can't usually progress past this point with the typical model viewer (at least Sketchfab is somewhat decent), but it isn't quite ready for use as a sprite yet. Either you can render it now and paint in some lighting (as is needed for model viewer screenshots or certain in-game shots), or you can move to the next step.

5) Set up the lighting.
You might have noticed in the above screenshot that the settings for a light source (the dotted circle in the top area of the viewspace) are there. We'll get to that.
The most important aspect of a model render is its lighting setup. Generally, lighting for such a purpose would involve a main light source above the model, usually in front and centered or to the left. Then there's a backlight opposite the main light, some other lights to add some specularity here and there, and some sort of overall illumination. The Super Shotgun from Doom 2, which I'll use as a lighting reference, apparently has a main light to the right and somewhat behind the weapon, a brown backlight (probably a reflection of Doomguy's arm), and some other lighting.
As for the light settings, some fiddling about with the Energy and Falloff Distance settings, as well as positioning of the light, can give you the desired look for each light. If you need a new light, you can either Shift+D the existing light to make a duplicate or go to the bottom left of the window and go to the Add menu to add a new lamp.
The desired shadowing of the lights depends on what the light is for and what kind of look you want. You typically would want either a soft shadow or no shadow at all, as a sharp shadow would make the render not look very passable. You can press F12 to render the camera's view or set the View Mode to Rendered to preview the result of your lighting.
Image
This is what I have set up for the SSG. Might be a bit dark, but at least the barrels are pretty close to the right lighting. Also note that I have Ambient Occlusion set in order to darken lighting around creases, making the lighting a little more realistic.

6) Render the model, then downsize/edit the result.
F12
Image
Render's ready (maybe not for me, but at least for the sake of the tutorial). Go to Image->Save as Image at the bottom (or F3) to save the render as an image.
You can size down the render to Doom resolution in whatever image editor you use (I use GIMP, and I size my 1280x800 renders down by half with no interpolation, then another half with Cubic interpolation; it's a neat little compromise between having smooth enough anti-aliasing and preserving details.
A decent enough render needs little to no editing, but certain cases (such as incompatible normal maps (THANKS DOOM 3) or just a single diffuse texture with nothing to control specularity and bump detail) may require further editing. You'll also want to work towards making it palette-friendly if that's the route you want to go with it. I'm not willing to go in-depth with either of those, but there are other tutorials out there for good weapon sprites that can serve as a guidance for editing a render.
Image
This is a rough draft of the final result. I removed the in-between alpha values by selecting the transparency, removing the alpha channel with the background set to black, re-adding the alpha, and deleting the selection. I also overlaid the original on top to reduce the black outlining, then I erased the pixels that were out of place.

So that's that. I hope this is readable enough to be of help, and again, please check out the Blender Manual if you need help with any functions or if you want to do even more with the rendering.
Last edited by Minigunner on Sun Apr 23, 2017 12:17 am, edited 1 time in total.
User avatar
Minigunner
 
Joined: 28 Dec 2009
Discord: Minigunner#5418

Re: Rendering Weapon Models for Spriting Purposes

Postby torridgristle » Mon Jun 27, 2016 1:02 pm

Minigunner wrote:I removed the in-between alpha values by selecting the transparency, removing the alpha channel with the background set to black, re-adding the alpha, and deleting the selection..

An alternative method for Photoshop is going to Layer -> Masks -> Mask from Transparency. This removes the alpha channel of PNGs and such where it's "baked in" and doesn't appear as a separate channel and allows you to put a threshold effect on it and adjust the edges.

Very nice tutorial.
User avatar
torridgristle
Sprites will be 120% tall in the game.
 
Joined: 23 Aug 2013

Re: Rendering Weapon Models for Spriting Purposes

Postby Nash » Tue Jun 28, 2016 12:23 am

Hey MG, what's the hand model from? Looks cool, care to post a .blend of just the hand, for modeling study purposes?
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Rendering Weapon Models for Spriting Purposes

Postby Minigunner » Tue Jun 28, 2016 7:56 am

It's Doom3guy's hands; I'll probably send you a .blend of them.
User avatar
Minigunner
 
Joined: 28 Dec 2009
Discord: Minigunner#5418

Re: Rendering Weapon Models for Spriting Purposes

Postby Nash » Tue Jun 28, 2016 8:00 am

Much appreciated, thanks!
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Rendering Weapon Models for Spriting Purposes

Postby GAA1992 » Thu Jun 30, 2016 10:53 am

Sorry for the off-topic question, but i use gimp as well. I found this trick of 0-interpolation-cubic interesting, but i can't try it now. Do you leave the layers indexed after that? Or just rgb? Great tutorial, btw. My objective is to have some centered pump shotguns. I'm really lacking good resources.
User avatar
GAA1992
Demons are a disease. Meet the cure.
 
Joined: 04 Jun 2015
Location: Killing spiders.

Re: Rendering Weapon Models for Spriting Purposes

Postby Minigunner » Thu Jun 30, 2016 10:59 am

In this case, I keep it RGB. I personally use external programs to convert the graphic to paletted (primarily Color Quantizer with this JASC format Doom palette) because GIMP has poor indexed conversion.
Last edited by Minigunner on Mon Apr 10, 2017 2:29 am, edited 1 time in total.
User avatar
Minigunner
 
Joined: 28 Dec 2009
Discord: Minigunner#5418

Re: Rendering Weapon Models for Spriting Purposes

Postby ghoul » Sun Jul 10, 2016 5:16 am

Nice tutorial, just what i was looking for. I've been using my own method but have not been able to acheive the same effect.

Could you please elaborate step by step how this is acheived: " I removed the in-between alpha values by selecting the transparency, removing the alpha channel with the background set to black, re-adding the alpha, and deleting the selection. I also overlaid the original on top to reduce the black outlining, then I erased the pixels that were out of place."

I've never used gimp and am generally not a very smart person and/or could someone apply this tutorial to this image
Image
, i would like to compare the correct result of the tutorial to my attempt. Thank you very much, i would really appreciate it.

Here's what it looks like using my own method in Unity.
Image
ghoul
 
Joined: 10 Jul 2016

Re: Rendering Weapon Models for Spriting Purposes

Postby NeuralStunner » Sun Jul 10, 2016 9:37 am

Your images were trying to escape the right edge of the forum, so I've shrunk them to linked thumbnails for you (as detailed here).

Interesting seeing someone go for the pixel-scaled look in Unity rather than filtering everything to death. Personally, I like the "modernized yet classic" effect.
User avatar
NeuralStunner
Cuddly but Packin'
 
 
 
Joined: 21 Jul 2009
Location: Indiana, USA
Discord: NeuralStunner#1293
Operating System: Windows Vista/7 64-bit

Re: Rendering Weapon Models for Spriting Purposes

Postby ghoul » Sun Jul 10, 2016 12:39 pm

NeuralStunner wrote:Your images were trying to escape the rigt edge of the forum, so I've shrunk them to ikned thumbnails for you (as detailed here).

Interesting seeing someone go for the pixel-scaled look in Unity rather than filtering everything to death. Personally, I like the "modernized yet classic" effect.


Thanks man. Perhaps i should stick to keeping this look. Here's how it currently looks in action http://webmshare.com/vEox0. Yes, the screenshake is over the top and i intend to tone it down.
ghoul
 
Joined: 10 Jul 2016

Re: Rendering Weapon Models for Spriting Purposes

Postby enderkevin13 » Wed Jul 27, 2016 9:43 pm

I could use this sometime. Thanks!
User avatar
enderkevin13
Official abbadon of ZDoom
Banned User
 
Joined: 07 Jul 2015
Location: :noiƚɒɔo⅃


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest