Trick: Changing Moho's Fixed 3D Light Direction! (+ Free Tool)

Have you come up with a good Moho trick? Need help solving an animation problem? Come on in.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
takuya
Posts: 46
Joined: Sun May 01, 2022 10:26 pm

Trick: Changing Moho's Fixed 3D Light Direction! (+ Free Tool)

Post by takuya »

Subject:
Hi everyone,

We all know one of the biggest frustrations with Moho's native 3D workspace: the light source is permanently locked to the bottom-right. If you want natural overhead daylight or rim lighting on a 3D prop, you are usually out of luck.

I was experimenting with this and figured out a geometric workaround. Since we cannot move the light source via the API, I tried doing the exact opposite. What if we perform a micro-orbit with the camera around the 3D object, while counter-rotating the object to keep its 2D silhouette exactly the same?

It actually works! It creates the illusion that the light source is moving around the 3D model.

Image

Doing this math manually across a timeline is a nightmare, so I wrote a pipeline utility to automate it. It calculates the camera orbit, safely renders the shading in the background, and automatically imports it back into your timeline as a clean PNG sequence inside a Switch Layer.

I’ve decided to release this tool (Shadow Baker 3D) 100% for free for the community.
(⚠️ Note: Because it relies on a background Python render engine calling Moho.exe, it is Windows ONLY at the moment).

You can download it for free here:
[Update: September 17, 2026]
Please note that the free distribution period for the sample kit has ended. The tool is now available as a paid version on my Gumroad store. Thank you!
https://2dpipelinetools.gumroad.com/l/shadowbaker3d

I hope this helps anyone trying to get better cel-shaded looks or customized lighting on their 3D props without leaving Moho. Let me know if you try it out!

Cheers,
Takuya
Last edited by takuya on Wed Sep 16, 2026 8:04 pm, edited 1 time in total.
User avatar
synthsin75
Posts: 10563
Joined: Mon Jan 14, 2008 2:20 pm
Location: Oklahoma
Contact:

Re: Trick: Changing Moho's Fixed 3D Light Direction! (+ Free Tool)

Post by synthsin75 »

Any reason you didn't use the silent image render from Moho's API?
https://mohoscripting.com/methods/mohol ... layerimage
takuya
Posts: 46
Joined: Sun May 01, 2022 10:26 pm

Re: Trick: Changing Moho's Fixed 3D Light Direction! (+ Free Tool)

Post by takuya »

Hi Wes,

Thank you so much for the tip!

I actually hadn't realized that `moho.layer:RenderLayerImage()` was available until you pointed it out. Seeing your suggestion, I immediately tested it out, hoping it could replace the external Python process with a 100% internal, silent Lua render.

However, after testing, I ran into a technical limitation with how it renders:
`RenderLayerImage` appears to be designed primarily for game engine texture/asset export (added in 14.4), so it renders the layer strictly in its fixed local texture space. Because of this, orbiting the scene camera (`fCameraPanTilt`) or changing the view angle does not affect the shading in the resulting output image—it always outputs the layer's local orthogonal view.

To capture the subtle shading changes created by orbiting the scene camera around the 3D model, I had to keep using Moho's command-line batch renderer via the background Python engine.

If `RenderLayerImage` could have an optional parameter or flag in a future update to respect the active scene camera's perspective and transform, it would be an absolute game changer—not just for game export, but for procedural in-app shading and baking utilities like this. I would love to see that if the dev team ever considers expanding that API!

On a related note, I recently updated the script's internal architecture (Python engine call and path resolution) to support macOS as well. However, since I don't own a Mac myself, I haven't been able to verify if the background CLI render works smoothly on macOS yet (experimental support). If any Mac users in the community happen to try it out, I'd really appreciate any feedback!

Thanks again for the great insight and suggestion!

Cheers,
Takuya
User avatar
synthsin75
Posts: 10563
Joined: Mon Jan 14, 2008 2:20 pm
Location: Oklahoma
Contact:

Re: Trick: Changing Moho's Fixed 3D Light Direction! (+ Free Tool)

Post by synthsin75 »

Ah, yeah, RenderLayerImage is specifically meant to get orthogonal view. I forgot about that.
takuya
Posts: 46
Joined: Sun May 01, 2022 10:26 pm

Re: Trick: Changing Moho's Fixed 3D Light Direction! (+ Free Tool)

Post by takuya »

**Quick Bug Report & Update (v2.11): Group Layer Support**

While testing, I noticed a bug in Moho's batch renderer (`Moho.exe -render`):

- **The Bug:** When a single vector layer has **multiple shapes with different colors** in 3D Extrude mode, the batch renderer incorrectly paints all front faces with the first shape's fill color (even though the GUI preview / `Ctrl+R` displays each color correctly).
Image
- **The Workaround:** If you separate each colored shape into its own vector layer and put them inside a **Group Layer**, the batch renderer renders everything properly.

Because of this, I updated **Shadow Baker 3D to v2.11** to fully support **Group Layers**!
You can now select a parent Group layer and bake multi-colored 3D setups seamlessly.
Last edited by takuya on Fri Sep 18, 2026 5:32 pm, edited 1 time in total.
takuya
Posts: 46
Joined: Sun May 01, 2022 10:26 pm

Re: Trick: Changing Moho's Fixed 3D Light Direction! (+ Free Tool)

Post by takuya »

Image

**Update (v2.12): "Pure 3D Mode" for Heavy 3D Layers + Auto-Save Integration**

Hi everyone,

I've just updated Shadow Baker 3D to **v2.12** with a couple of practical workflow improvements based on real production needs:
---
### 1. "Pure 3D Bake (0 deg Orbit / Moho Default)" Mode
Complex 3D objects or heavy 3D Layer Groups (such as multi-colored rigs or OBJ meshes) can severely slow down Moho's timeline playback and interactive editing.

To solve this, I redesigned the former "45 deg" preset into **"Pure 3D Bake (0 deg Orbit / Moho Default)"**:
- It completely disables the camera orbit offset (0° orbit), preserving the 3D model's exact posture, perspective, and Moho's native default lighting with **0% distortion**.
- It bakes the entire heavy 3D group into a clean, lightweight 2D PNG sequence inside a **Switch Layer** in one click.
- Once baked, your timeline becomes buttery smooth, allowing you to freely draw 2D character animation, composite effects, and scrub the timeline without any viewport lag.
---
### 2. Built-in Auto-Save (Foolproof Execution)
I often found myself forgetting to hit `Ctrl+S` before baking, which meant any recent posture tweaks on the timeline wouldn't be written to the project file and thus not reflected in the background render.

To make it foolproof, **both the "Preview" and "Bake" buttons now automatically trigger `moho:FileSave()`** right before launching the render engine. You no longer have to worry about unsaved changes ruining your render or losing edits.
---
### 3. Streamlined Progress Console
The background renderer now runs inside a single, unified console window that displays real-time progress (`[Frame X / Y] Complete`) and cleanly auto-closes upon completion—eliminating the annoying multiple window flashes.
---
Hope this makes working with 3D props and sets in Moho much lighter and easier!

https://sentakuclip.net/blog/8181/

manual DownLoad
https://sentakuclip.net/jetb/wp-content ... Manual.pdf

Cheers,
Takuya
Post Reply