Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Dieting Hippo

Palette Studio v1.2 - Create Doom sprites in Blender! (updated 2/28/2021)

Recommended Posts

I have to test this. I am using Nash's blender sprite rendered that is not updated to latest blender. I am nor really keen on automatic conversion to palette straight from blender, sice I want to do hand modification to sprites to make them fit the rest of DooM/HeXen sprites, so that feature is not really interesting to me. Also Nash's renderer is actually rotating the model instead of using multiple cameras which means lights can be setup that the sprite is illuminated from front on all sides. I fear that would be the biggest problem I have with this. I will see this weekend, I won't be able to get to it sooner.

Share this post


Link to post

Thanks for checkin' it out soon!

 

Re: Palette application, that's the main draw of Palette Studio and you won't be able to render out without having a palette selected. If you need to render without a palette, Blender itself is more than adequate for that.

 

However, if you do still want to modify the color-indexed sprites after rendering you can! All sprite images are saved as .png in the selected output folder, so you can open the sprites up in your image/sprite editor of choice and clean them up as needed. Additionally, since the sprite colors are already set to the colors of the palette selected, you can be sure that the colors applied to the sprite will also be the same colors in-game or in-editor with the indexed palette applied.

 

 

For lights, you can see in the Luigi Imp video at the bottom of the post that lighting can be evenly applied to all sides of the sprite without rotating any light sources. I currently use two sun light sources that are angled down toward the model, with the angles rotated 180 degrees around the Z axis. This provides a large amount of light coverage, while still allowing for some small adjustment lighting to be added.

 

I do plan on adding in the ability to select a group of lights with Palette Studio, which would then be rotated around the rig for each angle. However, that's on my pinboard of future feature ideas so I can't guarantee when that'll go in.

 

 

If you do find any bugs though, please let me know! v1.1 already squashed a lot of bugs, but I'm sure there's extra cases I haven't covered yet.

Share this post


Link to post

Ok, if the palette is forced than it's worthless to me. It means losing color data and making the editing afterwards even more tedious. Getting the lightning setup in blender to fully emulate DooM or HeXen style is next to impossible and it needs the hand touchups and hand coloring some parts color from precise palette ranges. Automatic will choose nearest color regardless of palette range and introduce more color crunching once I try to fix that.

And the lightning is another deal breaker. The Luigi sprites looks really washed up and flat. I use light from above and slightly from front a fill light and sometimes a rim light to punch up the volume of the object even more and that is still not enough to make it work without hand modifications.

Sorry if I sound kinda awful, I don't want to be too critical of hateful. I am interested in creating sprites to be as close to DooM and HeXen and this looks like more problems than solutions in the end. Vanilla Blender have one huge problem and that is lack of automatization for this specific thing of rendering sprites in 8 angles with consistent lightning. It's probably not that hard to make a script for that, but I have zero knowledge about blender scripting so I am destined to leech off projects like this or do the rendering by rotating and rendering the models by hand.

Share this post


Link to post

It is pretty harsh, not gonna' lie. The Luigis were more a proof of concept and can be redone with better lighting.

 

However I do believe you don't need a plugin, and this script will do what you need:

import bpy
from math import radians
from mathutils import Matrix

## Enter object name below ##
object_name = 'Cube'
## Enter file prefix below ##
file_prefix = 'CUBE'
## Enter file extension below ##
file_ext = '.png'
## Set true if global object rotation, false for local ##
rotation_global = True
## Set axis to rotate around ##
rotation_axis = 'Z'
##           ####            ##

def rotate_object(obj, angle_degrees, axis='Z'):
    if rotation_global:
        obj.rotation_euler = (Matrix.Rotation(radians(angle_degrees), 3, axis) @ obj.rotation_euler.to_matrix()).to_euler()
    else:
        obj.rotation_euler = (obj.rotation_euler.to_matrix() @ Matrix.Rotation(radians(angle_degrees), 3, axis)).to_euler()
    
object = bpy.context.scene.objects[object_name]
filepath = bpy.context.scene.render.filepath
absolutepath = bpy.path.abspath(filepath)

for i in range(0, 8):
    bpy.context.scene.render.filepath = absolutepath + file_prefix + str(i+1) + file_ext
    bpy.ops.render.render(write_still=True)
    rotate_object(object, 45, rotation_axis)
    
bpy.context.scene.render.filepath = absolutepath

Toss it in a text editor window in Blender, change "object_name" to the name of the object in the scene to rotate, "file_prefix" to whatever you need, and the rest of the options as needed. Once that's all done, press the play button at the top of the text editor. As it is now this will rotate an object named "Cube" around its Z axis and render out to files CUBE1.png, CUBE2.png, and so on. The output directory will be what your current render path is set to, so be sure to set that beforehand.

 

I understand the frustration of not being able to find something like this easily (especially Blender scripting), but don't be harsh when it's a tool not specifically designed for what you have in mind. I hope the above script helps you out.

Share this post


Link to post

this is awesome mate, you are a saint for making and sharing something like this!

Share this post


Link to post

I don't know about you guys but I wanna cruze that little motorcycle/chopper thing around! :P

Do you think your Add-On for Blender may stay compatible with future versions of Blender?

I remember Add-On script authors having to update their script when ever a new Blender version was released, is this still the case?

Share this post


Link to post

Thanks y'all! I hope it does stay compatible for a while. There was a large jump between Blender 2.79 and 2.80 which broke a lot of plugins, but I wouldn't anticipate any large breaking Blender updates for a while. If anything does break due to an update I will try my best to fix it though!

Share this post


Link to post
13 hours ago, Dieting Hippo said:

It is pretty harsh, not gonna' lie. The Luigis were more a proof of concept and can be redone with better lighting.

 

However I do believe you don't need a plugin, and this script will do what you need:


import bpy
from math import radians
from mathutils import Matrix

## Enter object name below ##
object_name = 'Cube'
## Enter file prefix below ##
file_prefix = 'CUBE'
## Enter file extension below ##
file_ext = '.png'
## Set true if global object rotation, false for local ##
rotation_global = True
## Set axis to rotate around ##
rotation_axis = 'Z'
##           ####            ##

def rotate_object(obj, angle_degrees, axis='Z'):
    if rotation_global:
        obj.rotation_euler = (Matrix.Rotation(radians(angle_degrees), 3, axis) @ obj.rotation_euler.to_matrix()).to_euler()
    else:
        obj.rotation_euler = (obj.rotation_euler.to_matrix() @ Matrix.Rotation(radians(angle_degrees), 3, axis)).to_euler()
    
object = bpy.context.scene.objects[object_name]
filepath = bpy.context.scene.render.filepath
absolutepath = bpy.path.abspath(filepath)

for i in range(0, 8):
    bpy.context.scene.render.filepath = absolutepath + file_prefix + str(i+1) + file_ext
    bpy.ops.render.render(write_still=True)
    rotate_object(object, 45, rotation_axis)
    
bpy.context.scene.render.filepath = absolutepath

Toss it in a text editor window in Blender, change "object_name" to the name of the object in the scene to rotate, "file_prefix" to whatever you need, and the rest of the options as needed. Once that's all done, press the play button at the top of the text editor. As it is now this will rotate an object named "Cube" around its Z axis and render out to files CUBE1.png, CUBE2.png, and so on. The output directory will be what your current render path is set to, so be sure to set that beforehand.

 

I understand the frustration of not being able to find something like this easily (especially Blender scripting), but don't be harsh when it's a tool not specifically designed for what you have in mind. I hope the above script helps you out.

 

I am really sorry for sounding so harsh. For me the flexible and precise automatic rendering is just endlessly more interesting than palette conversion that can be done very easilly in many programs including SLADE. But thank you a lot for the script, I will try it too.

Share this post


Link to post

Palette Studio v1.2 is out! Check out all the nifty stuff I added in this release:

  • Select individual indices of a palette. (ex: 0,3,9,11,12,13 or 0,3,9,11-13)
  • Use 1, 8, or 16 cameras. Each selection will set the appropriate ID character for the filename, including 9-G for ZDoom's 16-angle support.
  • Create a light rig and parent lights to it to rotate the lighting for each render.

More details in this devpost here: https://dietinghippo.itch.io/palette-studio/devlog/227087/palette-studio-v12-out

 

This is a huge release, and I hope these additions add features that help people out that weren't feasible before. As always, let me know if there's any bugs and I'll try address them. If you do make sprites with Palette Studio, please post 'em!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×