Realtime Lighting

Does needle engine supports realtime lighting with point light or spot light?

Yes, Saad Baig, Needle Engine supports real-time lighting with both point lights and spot lights. In the Light component, you can create directional, spot, or point lights, and specify them to be either baked or real-time.

The key details are as follows:

  1. Light Types Supported:

    • Spot Light
    • Directional Light
    • Point Light
  2. Real-time Capabilities:

    • Lights can be set as real-time, meaning they can change properties (like position, orientation, color, and intensity) during runtime without the need for baking.
    • Shadows can be cast from these lights, with options for hard or soft shadows.

Here’s a quick overview of the relevant code snippet from the Light class in Needle Engine:

export enum LightType {
    Spot = 0,
    Directional = 1,
    Point = 2,
    ...
}

public class Light extends Behaviour implements ILight {
    @serializable()
    private lightmapBakeType: LightmapBakeType = LightmapBakeType.Realtime;

    ...
}

This code confirms that real-time lights (including point and spot lights) can be implemented using Needle Engine (see the documentation) (see the documentation).

For more detailed implementation, consider checking the official Needle Engine documentation and samples:

If you have any further questions or need assistance with specific implementations, feel free to ask!

3 replies left
thread_aZ1S4mE4Q7MLQY7qVYDJT8JJ
Reply to this message to continue the conversation

why don’t my lights show up in the exported scene?

Hi Saad Baig,

To troubleshoot why your lights aren’t showing up in the exported scene, please consider the following common issues:

  1. Light Baking Settings: Ensure that your lights are set to “Realtime” rather than “Baked” if you want them to affect the scene dynamically and be exported.

  2. Light Layer Settings: Check if the lights are assigned to the correct layer that your camera or scene is capable of rendering.

  3. Shadow Settings: Verify if the lights’ shadow settings are configured properly. Sometimes, lights may produce shadows that help to define their presence but might not visually appear if incorrectly set.

  4. Export Configuration: Make sure that your export configuration includes lights. Some exporters may require specific settings to include lighting information.

  5. Scene Hierarchy: Ensure that lights are not inadvertently disabled or that they’re positioned within the bounds of the camera’s view in the exported scene.

  6. Testing Within the Editor: Simulate the scene within the editor to confirm that lighting works as expected before export.

If you’ve checked all these points and the issue persists, could you provide further details, such as:

  • Which version of Needle Engine you are using?
  • Are you testing in a specific environment (e.g., Unity or Blender)?
  • Any error messages or logs during the export process?

By sharing these details, I can assist you more effectively!

2 replies left
thread_aZ1S4mE4Q7MLQY7qVYDJT8JJ
Reply to this message to continue the conversation


this is the result i see on the web after increasing the intensity high . While on the unity editor it looks really bright.

Hi Saad Baig,

The issue you’re facing where the lights appear brighter in the Unity editor compared to the exported web scene can stem from several factors. Here are a few things to check:

  1. Tonemapping and Gamma Correction:

    • Different platforms may apply different tonemapping and gamma correction settings. You may want to ensure that the tonemapping in your web scene matches your Unity rendering settings. There are patches and settings for tonemapping in the Needle Engine that can affect how brightness is perceived (see the documentation).
  2. Light Intensity Factor:

    • Ensure that your light intensity is being computed consistently across environments. There might be a factor applied during WebXR that alters the perceived intensity (see the documentation).
  3. Environment Lighting:

    • The background or ambient light settings can influence how the lights appear. If the ambient intensity is different between environments, this may give the impression of different light intensities (see the documentation) (see the documentation).
  4. Bloom Effects:

    • If you are using post-processing effects like bloom, the threshold and intensity settings can impact how light is visually represented. Make sure these settings are configured properly (see the documentation) (see the documentation).
  5. Export Settings:

    • Look into the export settings to ensure that there are no parameters overriding your light settings (e.g., converting intensity values) when exporting from Unity to the web (see the documentation).
  6. Material Properties:

    • Verify if materials are being handled differently across the two environments. Material settings can also lead to visual discrepancies between the editor and the web (see the documentation).

By reviewing these areas, you might identify what’s causing the variance in lighting appearance between Unity and your web project. If you continue to experience issues, please share details about your current light settings or any custom configurations you’ve applied.

1 replies left
thread_aZ1S4mE4Q7MLQY7qVYDJT8JJ
Reply to this message to continue the conversation

Hello Saad, is the scene using lightmapping? And can you show your light’s settings in Unity?


I tried with enabling the realtime Gobal Illumination but it didn’t work either.
Is there any component that I should check is attached in the scene?

@marcel is there anything I should change here?

Can you show the light component settings?

We’re aiming to match Unity’s light output very closely.

To be able to help here, please include the following information:

  1. Unity version
  2. Render pipeline (e.g. BiRP or URP) and version
  3. If the project is set to Linear or Gamma color space
  4. If lightsUseLinearIntensity is on or off (see Unity - Scripting API: Rendering.GraphicsSettings.lightsUseLinearIntensity, you may have to fetch the value via code)
  5. Environment settings (e.g. a screenshot of the Lighting window with skybox, custom reflection, intensity values)
  6. Do you have any warnings related to Linear/Gamma in the console upon exporting?

Unity v 2022.3.41f1
URP - how to find the version?
Project is set to Linear color space.
There’s no warning related to Gama/Linear in the console when exporting.
I wasn’t able to fetch lightUseLenarIntensity, i attached C# script to an object but couldn’t see any logs of it. Does the C# script compiles when using needle engine?



I noticed render pipeline asset was missing. But even after it I have to set light intensity to more than 100 to see the effect of the light.

Unity C# scripts work/compile the same way as before! Regular Unity C# projects and Needle projects can live alongside in the very same scene/project and we’re taking great care to not interfer with anything that would stop your normal Unity builds from working (just like any good Unity package should)

You may need to disable Override Enter Playmode in ProjectsSettings/Needle if you want to enter regular Unity playmode

OR print your codesnipped in Unity’s OnValidate() function which is run in the editor

Okay thanks for the tip.
Any reason why realtime point light’s intensity has to be set above 100 to see the effect?

Do you think you could send a bugreport with the scene + lightmapping setup you have now?

Sure, does it include lightmaps automatically in the bug report?

Yes it does