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

Palette Studio v1.3.1 - Create Doom sprites in Blender! (updated 7/14/2023)

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

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

@Ganbare-Lucifer Hey thanks for giving it a shot! Here's my layout for the scene composition nodes, your nodes should roughly match this layout:

image.png


The 'Render Layers' node will feed into your post-processing nodes (in my case, color adjustments and sprite scale/cropping), then into the 'Viewer' node. In my scene I also have one of the Camera Rig cameras selected as the scene's camera, so manual rendering will use that camera. Let me know if this works for you!

Keep in mind - the results you will get from manually rendering will not match the final output, as the 'Render' button in Palette Studio's UI will perform the palette swap when it generates the finished sprite images. This can't be done via the manual render because I had issues trying to make this operation a Composition node itself, so if anyone with more Blender knowledge knows how to make a node that will execute code I am all ears!

Share this post


Link to post
On 2/25/2021 at 7:35 AM, Mr.Rocket said:

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?

 

Small update on this: Palette Studio is working with Blender 3.2.1, so it seems to be staying compatible with future versions. If any bugs are hit I will try to knock those out.

Share this post


Link to post
23 hours ago, Dieting Hippo said:

@Ganbare-Lucifer Hey thanks for giving it a shot! Here's my layout for the scene composition nodes, your nodes should roughly match this layout:

image.png


The 'Render Layers' node will feed into your post-processing nodes (in my case, color adjustments and sprite scale/cropping), then into the 'Viewer' node. In my scene I also have one of the Camera Rig cameras selected as the scene's camera, so manual rendering will use that camera. Let me know if this works for you!

Keep in mind - the results you will get from manually rendering will not match the final output, as the 'Render' button in Palette Studio's UI will perform the palette swap when it generates the finished sprite images. This can't be done via the manual render because I had issues trying to make this operation a Composition node itself, so if anyone with more Blender knowledge knows how to make a node that will execute code I am all ears!

Nice! Thank you! I was so confused why the nodes weren't showing or anything, I can finally use these settings!

...But, the transparency is gone.

REGUF1.png.6c34bf889d64b7498b7fb6af9d2eb4dd.pngI tried to fix it with transparency BG but the outputs end up emptying the frames, the closest solution I had is that while in rendering mode, I open the still existing file in Aseprite before the rendering finishes and vanishes the picture, save the ones in Aseprite to restore the render.

Edited by Ganbare-Lucifer

Share this post


Link to post

Hmm, I can think of a few things off the top of my head that might help re-enable transparency but these are mainly troubleshooting guesses that I'm hoping will work. If these don't work, feel free to DM me the Blender file and I can take a look directly to see where this might be having hiccups.

 

1) Enable "Transparent" in Render Properties.
image.png.223897a8c4d67380a69ac00d5e2cc230.png

 

2) In Output Properties, set the output to PNG with RGBA color.
image.png.0b0b7cb2ca78e45732fd9ea0515b0866.png

 

3) In the Palette Studio UI, ensure "Alpha" is checked. The threshold value shouldn't matter too much if there's no partial transparency, but I have it set to 0 currently and that works fine.
image.png.63d52c51ad2ccf5cb2085a2b3fdeec60.png

 

4) In the scene compositor, ensure "Use Alpha" is checked for the Viewer Node.
image.png.173c02bc5760eda06b0531338efd6ded.png

 

It's also odd that the finished render from hitting "Render" completely blanks out when it finishes the palette swap. If this transparency fix doesn't work or you keep getting blank finished renders I will be happy to take a closer look!

Share this post


Link to post
45 minutes ago, Dieting Hippo said:

Hmm, I can think of a few things off the top of my head that might help re-enable transparency but these are mainly troubleshooting guesses that I'm hoping will work. If these don't work, feel free to DM me the Blender file and I can take a look directly to see where this might be having hiccups.

 

1) Enable "Transparent" in Render Properties.
image.png.223897a8c4d67380a69ac00d5e2cc230.png

 

2) In Output Properties, set the output to PNG with RGBA color.
image.png.0b0b7cb2ca78e45732fd9ea0515b0866.png

 

3) In the Palette Studio UI, ensure "Alpha" is checked. The threshold value shouldn't matter too much if there's no partial transparency, but I have it set to 0 currently and that works fine.
image.png.63d52c51ad2ccf5cb2085a2b3fdeec60.png

 

4) In the scene compositor, ensure "Use Alpha" is checked for the Viewer Node.
image.png.173c02bc5760eda06b0531338efd6ded.png

 

It's also odd that the finished render from hitting "Render" completely blanks out when it finishes the palette swap. If this transparency fix doesn't work or you keep getting blank finished renders I will be happy to take a closer look!

 

I came to tell that the Palette Studio threshold was the issue, I fixed it, thank you.

Share this post


Link to post
3 minutes ago, Ganbare-Lucifer said:

 

I came to tell that the Palette Studio threshold was the issue, I fixed it, thank you.

Awesome! I am super glad to hear, and I hope to see the sprites you make with it!

Share this post


Link to post
On 12/13/2022 at 2:25 PM, TheProgressiveGamer said:

Im trying to find the Palette Studio UI to find "Alpha" but its not showing up. What do I have to do to get it to show up. 

It'll be located with the "Tools" on the top-right corner of the 3D Viewport. Select the "Palette Studio" tab, then go to the "Render" section.

image.png.1699c2fe047da50e36f27388479e3a13.png

Share this post


Link to post

I know this is an old thread but I can't find any newer ones on Palette Studio.

I've recently added to this script for my own usage where it can now also render a range of animation frames and can also have the palette turned off.

Just wanting to share it here: Palette Studio with Animations

I'll usually make some rough animation frames of the model like three or four walking frames, etc.

Share this post


Link to post

Hey! I forgot to update the thread earlier this year when I made some extra changes, but v1.3.1 was released! It's got a few features that were asked for and more:

 

- Color paletting can now be disabled!

- Full camera rig control from the Palette Studio UI, including uniform angle/radius/height adjustment.

- Ability to name output frames with simple numbers (1-16) in angle order, or with the Doom/GZDoom frame scheme (1-9, A-F) for specific angles.

- Outputting sprite animations has been implemented, along with the option for a render frame name postfix. There's now the option to either output the current frame, or the animation timeline. This also includes each animation frame for each camera angle enabled! An 8-angle sprite render with 10 frames of animation will output 80 individual sprites.

- Rendering now shows in the work view the current camera/position being rendered! Blender is still incredibly busy during the render, but now there's some visual feedback while rendering.

 

The full update notes (v1.3 and v1.3.1) can be viewed here: https://dietinghippo.itch.io/palette-studio/devlog/560236/palette-studio-v131-now-out-to-fix-bugs-and-add-more-features

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
×