Ray-MMD Advanced Lighting: A Night on the Town

Ray-MMD Advanced Lighting: A Night on the Town... Trackdancer shows a method to create a fantastic nighttime scene in MMD MikuMikuDance.


Ray-MMD Advanced Lighting:
A Night on the Town

A feature article on LearnMMD by Trackdancer2015!You sometimes see urban scenes of Tokyo at night in Japanese anime with a plethora of lights from different sources, office building, street signage and the like as in the image shown below.

Image source: www.japan-guide.com ... Tokyo at night... try THAT with MMD ... !Ray-MMD advanced lighting demonstration.

Tokyo street at night. Image source: www.japan-guide.com. Image re-used here for non-commercial, illustrative purposes only as permitted under Fair Use guide-lines.A scene like this can be quite a challenge to replicate, not just in MMD, but in any computer rendered scene, simply because of the multiple Editor’s Note: LearnMMD has several Ray-MMD and Raycast tutorials... some are more “learned” than others but you might review each of them so as to get of the tips and ideas they offer as you learn from the experiences of the various authors. CLICK this box to see them all.light sources that needs to be accounted for.

But it can be effectively faked and it is worth doing, especially if you want to create a “wow” factor in your MMD project. This article will show you some Ray-MMD advanced lighting techniques you can use to “simulate” a multi-source lighting environment using Ray-MMD/Raycast. The techniques discussed here will explain how to create a street scene, but the same method can be effectively used for a concert performance project.


The model components required are actually quite simple, at least for our demo project. These are as follows:

  • A night time sky box; we will be using the SKY NIGHT sky box that comes with Ray-MMD.
  • A night version of an urban stage. We will be using the night version of BTA’s Gull Town because it has night texture as well as Auto-Luminous support. The stage is supplied in .x format; this was upgraded to PMX format for use in this project.
  • A MMD model; use one of your own choosing if you are following along with this discussion, but we will be using Mamama’s model of Yukari.


Our initial set up is shown below:

Initial Set-up of stage as we get ready to try Ray-MMD advanced lighting demonstration Raycast

A cursory examination of the set up indicates that the lighting that we want to consider the most important to factor in are as follows:

  • The primary lighting coming from the global light source.
  • The pink neon “Tako” sign.
  • Street lighting.
  • Lighting from the shops and surrounding buildings.

There are a lot of colored lights to factored in, but we can rationalize the colors needed just by examining the scene above and these would be:

  • neutral to dark gray global lighting since it is night time.
  • bright pink, red, yellow, green from the neon lights.
  • warm yellow lighting from the incandescent lamps in the stores.
  • cold green lighting from the fluorescent lamps from some of the offices.

Honestly, we do not have to account for all of these different light sources for our purposes; it will make our project much easier to just aggregate the different light sources and using this type of strategy we can reasonably shorten the list to include only the following:

  • neutral to dark gray global lighting
  • bright pink and warm yellow
  • optionally mix in a little red and green lighting

Also, we will want the global lights coming from the front of the model and the pink and yellow light coming from behind the model.

So what about the blues? Simple: blue will be factored in when we set up the overall ambient lighting conditions.

The main lesson to be learned here is that whenever you attempt to replicate a real world lighting environment using Ray-MMD, it pays to make at the start, at least a cursory examination of what would be the logical light sources.


At this point we need to load the rest of the primary components and these are:

  • Yukari; we applied a pose to her as well as main.fx
  • ray_controller.pmx and ray.x
  • sky with lighting.fx to the sky box under the EnvLightMap tab.

To the town model itself we applied the following:

  • main.fx under the main tab
  • materials/Editor/Standard/material_editor_1.fx to it under the materials tab
  • Auto Luminous

We could also use the Ray-MMD emissive materials to turn on the lights on this model but Auto Luminous is a lot simpler. Also we used the editor material as this comes with a controller and gives us fine controls over the material’s behavior. Honestly, even here I am using a brute force approach to the town’s materials but this was done for the sake of simplicity.

The controller for the material is called: Editor_1.pmx and is found in the same folder as the material’s .fx file. Each of the Editor materials have their own controller. I chose to use this material on the town model as I needed better control over the way the building walls absorb and reflect light Essentially, I applied a dampening effect on the material to stop the planar surfaces from reflecting light like a mirror.

Next we sorted out the Draw Order which should read as follows:

  1. Sky box (Night Sky)
  2. The stage model (Gull Town Night)
  3. The MMD model (Yukari)
  4. The Ray-MMD controllers (Editor_1.pmx and ray_controller.pmx)


Because there will be a lot of settings, in this article, it would be somewhat pointless and extremely tedious to note all the settings used. Instead, we will just focus on the lighting strategy and its implementation in the text of this article.

With the global light set up, what I wanted to do first was set up the scene’s lighting assuming only that it is lit by the moon and the resultant ambient lighting (light reflected off the surfaces in the environment). The images below shows the results of my initial settings. Please note that the scene is being designed to be view-able from almost any angle; an important consideration if you’re planning to use this type of set up to create a video that features multiple camera angles. Also, my Ray-MMD configuration has the DOF functionality enabled and at this point, this has not been adjusted. One of the considerations is that even at this stage, the lighting set up needs to be “usable without additional enhancements”; the other important consideration is that I can tweak it further as needed.

If you scroll up to see the photo of the Tokyo street by night and compare that with the images below, the renderings below should already be very similar in terms of “look and feel“.


If you look at the door way behind Yukari in the middle image above, it looks rather dim. What we want to do next is to brighten up that area and bring out some of that light, far enough to illuminate the back side of Yukari. To do this we use a sphere light which has been positioned inside the canopy above the doorway. The default sphere light throws out very harsh shadows and that will be a dead giveaway that we are “faking it”. To resolve this issue we use another lighting solution: sphere_light_with_shadow_low.fx which is found in the ambient options folder for the sphere light model.

Shown below is the scene before the sphere light is added and after it is added. It is actually very subtle but it makes a big difference, which is exactly what we want. Those textured window lights now look like they are really throwing out light. Note also that the sphere light has been configured to throw out the same color light as the window lights: a yellow tungsten hue.

Add accent lighting to enhance MMD nighttime scenes Ray-MMD advanced lighting... Raycast

Likewise across the street, we used a tube light with a yellow light to accent the shop as well as the area around it. You do not have to do this for all the shops; just the ones closest to the main performance area. These little touches helps to bring “life” to the scene.

There is a lot to look at in scenes like these; too much for the mind to take then all in, so the strategy isn’t to replicate every detail, rather, it makes more sense just to highlight the more obvious details. The thinking is very like what magicians do; make people see what you want and not see what you don’t want them to see. Things can be hidden even when they are in plain sight simply by using distraction techniques. Plus, with urban night scenes, you really want some sharp contrasts between areas of bright and dark; it adds visual richness to the overall imagery.

I continued to add more accent lights to accentuate key areas in the scene and the following images below shows the results of my efforts. I could have used much more but for the purposes of this article, the ones I used more than sufficed.

The 4 accent lights that were used are:

  • 1x sphere light
  • 1x tube light
  • 2x rectangular lights

Ray-MMD does come with a good assortment of add-on supplementary lights; more than sufficient to meet most fill-light and special lighting scenarios. Just develop the knack for choosing the right one for the purpose that you want to achieve.

Use Raycast accent lighting to enhance MMD nighttime scenes Ray-MMD advanced lighting... Raycast

To achieve the levels of illumination in the 3 images above, further tweaks were needed to the global settings and as you can see, the light now falling on Yukari has been evened out, eliminating much of the harsh and unflattering shadows that were evident in the earlier images.

Further, the city-scape has “livened” up and there is a decent mixture of well illuminated spaces as well as darkened areas; this helps reinforce an impression of volume and depth in addition to making the background scenery much more interesting and vibrant . Plus there is also a good mixture of warm and cold light sources evident.

The “Tako” signage behind Yukari is now a lot brighter and some of it’s light together with the lights from the windows behind her are visually having an effect on her person. This is exactly the way you would expect things to look if this were in a real world situation.


I hope that this article and its presentation has served to highlight some of the tools and techniques required to carry out a project like this. Honestly, it does require a lot of planning and patience to successfully pull off something like this. Even here, with this presentation, I took a lot of short cuts and fudging just to keep things manageable; but the real purpose of this exercise is to demonstrate that something as complex as this type of night scene can be done using MMD.

Also, I really hope that by reading this, you will try out the strategies and tools outlined here and have a go at making videos or pictures with them. The end results are well worth the investment in time, if not just for others to enjoy but for your own self-satisfaction.

In closing, I will leave you with one last image; this time rendered for full screen viewing, just so to show the actual quality of the imagery in better detail than can be seen in the small 450 pixel wide images above.

Thanks for reading; if you have any questions, please feel free to leave a comment below.



  • Yukari model by Mamama
  • Miku Append by TDA
  • Gull Town stage by BTA Kerorin Jo
  • MMD 9.31
  • Auto Luminous 4
  • Ray-MMD 1.5.0
  • Irfanview
  • Yukari © 2016 VOCALOMAKETS powered by Bumpy Factory Corp.

If you want the pose I used on Yukari, it can be downloaded here from my GOOGLE DRIVE.


Visit the LearnMMD.com Homepage! Plenty of Mikumikudance instruction and info!