Hi, I’m new to using the Needle Engine, and I’m trying to adjust the lighting settings. I want to use an HDRI as the background but without affecting the lighting in the scene. Basically, I want it to look similar to Blender’s material view when only the diffuse color is selected, as shown in the attached screenshot. Since the lighting is already baked into the texture, I don’t need any additional light sources. Is it possible to achieve the same results in Needle Engine as I’m getting in Blender?
Hi Shaheer,
To achieve an HDRI background in Needle Engine without affecting the scene lighting, you can set up your environment settings while ensuring your ambient light settings and reflections are configured properly.
- Set the Ambient Mode: Use the
AmbientMode.Flat
to ensure that only diffuse colors are used from your textures, similar to Blender’s material view. - Configure Environment Settings: Load your HDRI image as the environment and control the
ambientIntensity
to be 0 if you want to prevent any additional lighting from that source. - Enable Skybox or Reflection: You can register your HDRI texture as an environment reflection but handle the lighting settings to prevent it from affecting the scene.
Here’s a sample code setup based on your requirements:
import { SceneLightSettings, AmbientMode } from "@needle-tools/engine";
const setupLighting = (scene) => {
// Create a new light settings object for your scene
const lightSettings = new SceneLightSettings();
// Set ambient mode to Flat
lightSettings.ambientMode = AmbientMode.Flat;
// Set ambient intensity to 0 to disable ambient lighting effects
lightSettings.ambientIntensity = 0;
// Set the environment reflection source, assuming `hdrTexture` is your loaded texture
lightSettings.environmentReflectionSource = DefaultReflectionMode.Custom;
lightSettings.ambientLight = new Color(1, 1, 1, 1); // Set ambient color if needed
// Adding the settings to the scene
scene.add(lightSettings);
};
// Example usage in your main scene initialization
setupLighting(myScene);
Key Points:
- Use an HDRI only for the background and reflections without contributing to the ambient lighting.
- Ensure all ambient settings are set correctly to mimic Blender’s material view.
For more details, you may need to refer to the lighting settings documentation within Needle Engine (see the documentation). This setup should allow you to better replicate the look from Blender in your Needle Engine setup. If you need further help, feel free to ask!
3 replies left
thread_6aOxZcKUbuM0KxLnk1goXrI0
Reply to this message to continue the conversation
Try setting the environment strength to a very low number but not 0
This seems to work but, there’s still clarity and color difference, if you compare the two images.
Hi, if all your textures are baked you should just use an Unlit marterial.
To do this directly connect your texture output to the Material Surface Slot (note the BSDF node is not connected below and not used)
Thank you!
The results are getting better, but I need more contrast to it, I am trying options atm if you have any suggestions for that as well please let me know!
Which tonemapping are you using?
I am not using any, however, in blender the contrast is set to very high.
Ok so you modified your effects in Blender. We currently only export Bloom, Ambient Occlusion and Tonemapping - I will add Contrast as a feature request. In the meantime I think you’d need to adjust the contrast in the textures.
Got it, are the same options available for the Unity add on as well?
Yes - in Unity we do support more postprocessing effects (see docs)
Alternatively you could add a little script to your web project to modify postprocessing slightly to achieve the desired look (as said, we don’t export contrast yet from Blender but you can also access and modify anything in the scene at runtime with very little effort)
Here’s an example that you can copy into your web project (you can remove the dummy content in the code)
With “contrast set to very high”, do you mean this option? Or something else?
Yes, that is correct.
Thank you, this is exactly what I was looking for and I am going to try that, and if I happen to have any questions I will reply here!
I greatly appreciate your help!
Thanks A lot