Rendering Weapon Models for Spriting Purposes

Handy guides on how to do things, written by users for users.

Moderators: GZDoom Developers, Raze Developers

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.
Post Reply
User avatar
Minigunner
Posts: 754
Joined: Mon Dec 28, 2009 5:13 pm

Rendering Weapon Models for Spriting Purposes

Post by Minigunner »

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 Sat Apr 22, 2017 11:17 pm, edited 1 time in total.
User avatar
torridgristle
Posts: 684
Joined: Fri Aug 23, 2013 9:34 am

Re: Rendering Weapon Models for Spriting Purposes

Post by torridgristle »

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
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Rendering Weapon Models for Spriting Purposes

Post by Nash »

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
Minigunner
Posts: 754
Joined: Mon Dec 28, 2009 5:13 pm

Re: Rendering Weapon Models for Spriting Purposes

Post by Minigunner »

It's Doom3guy's hands; I'll probably send you a .blend of them.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Rendering Weapon Models for Spriting Purposes

Post by Nash »

Much appreciated, thanks!
User avatar
Dr_Cosmobyte
Posts: 2755
Joined: Thu Jun 04, 2015 9:07 pm
Location: Killing spiders.

Re: Rendering Weapon Models for Spriting Purposes

Post by Dr_Cosmobyte »

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
Minigunner
Posts: 754
Joined: Mon Dec 28, 2009 5:13 pm

Re: Rendering Weapon Models for Spriting Purposes

Post by Minigunner »

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 1:29 am, edited 1 time in total.
ghoul
Posts: 2
Joined: Sun Jul 10, 2016 4:06 am

Re: Rendering Weapon Models for Spriting Purposes

Post by ghoul »

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
User avatar
NeuralStunner
 
 
Posts: 12325
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Rendering Weapon Models for Spriting Purposes

Post by NeuralStunner »

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.
ghoul
Posts: 2
Joined: Sun Jul 10, 2016 4:06 am

Re: Rendering Weapon Models for Spriting Purposes

Post by ghoul »

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.
User avatar
enderkevin13
Posts: 1383
Joined: Tue Jul 07, 2015 7:30 am
Location: :noiƚɒɔo⅃

Re: Rendering Weapon Models for Spriting Purposes

Post by enderkevin13 »

I could use this sometime. Thanks!
Post Reply

Return to “Tutorials”