Poor Support for Dynamic Number of Lights in GLSL Mode #40086

Closed
opened 2014-05-08 02:50:53 +02:00 by Mitchell Stokes · 17 comments

Our GLSL shaders assume a fixed number of lights (the lights available in the Blender scene when the shader is generated). This causes issues when adding lamps to the scene with add object (#20275) or adding new lights via libload (#27030).

Some possible solutions:

Recompile shaders when the number of lights change. The problem with this is recompiling shaders can be slow, especially with lots of materials and no shader cache (I think only NVIDIA cards have a shader cache at the moment).

Change where shaders get light data from. We could pass an array of light structs (e.g., via uniform buffer objects) to shaders. This would allow us to change the number of lights in a scene (up to some maximum array size, unless we do texture objects, but that seems silly) without recompiling shaders. Unfortunately, this would introduce looping and branching into the generated code, which could slow down our shaders.

Move away from forward rendering. Techniques such as deferred/inferred rendering/lighting grab light data from a buffer that is filled at render time. This allows for a lot of dynamic lights, but we probably wouldn't want to drop our forward rendering, so this would only be a partial solution.

Our GLSL shaders assume a fixed number of lights (the lights available in the Blender scene when the shader is generated). This causes issues when adding lamps to the scene with add object (#20275) or adding new lights via libload (#27030). **Some possible solutions:** **Recompile shaders when the number of lights change.** The problem with this is recompiling shaders can be slow, especially with lots of materials and no shader cache (I think only NVIDIA cards have a shader cache at the moment). **Change where shaders get light data from.** We could pass an array of light structs (e.g., via uniform buffer objects) to shaders. This would allow us to change the number of lights in a scene (up to some maximum array size, unless we do texture objects, but that seems silly) without recompiling shaders. Unfortunately, this would introduce looping and branching into the generated code, which could slow down our shaders. **Move away from forward rendering.** Techniques such as deferred/inferred rendering/lighting grab light data from a buffer that is filled at render time. This allows for a lot of dynamic lights, but we probably wouldn't want to drop our forward rendering, so this would only be a partial solution.
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @Moguri

Added subscriber: @Moguri

#27030 was marked as duplicate of this issue

#27030 was marked as duplicate of this issue

#20275 was marked as duplicate of this issue

#20275 was marked as duplicate of this issue
Author
Member

Added subscriber: @kupoman

Added subscriber: @kupoman
Author
Member
Added subscribers: @qwertyuiopia, @iflowproduction, @ideasman42, @brecht, @chewbacca, @dfelinto
Author
Member

◀ Merged tasks: #27030, #20275.

◀ Merged tasks: #27030, #20275.
Member

Added subscriber: @JorgeBernalMartinez

Added subscriber: @JorgeBernalMartinez

Added subscriber: @solarlune

Added subscriber: @solarlune

Added subscriber: @mahalin

Added subscriber: @mahalin
Mitchell Stokes changed title from Poor Support Dynamic number of Lights in GLSL Mode to Poor Support for Dynamic Number of Lights in GLSL Mode 2014-05-20 08:40:17 +02:00

Added subscriber: @JacobMerrill-1

Added subscriber: @JacobMerrill-1

Added subscriber: @MirceaKitsune

Added subscriber: @MirceaKitsune

I would love to see support for deferred rendering,
would it simplify the rendering code or complicate it more?

would the core dvelopers need deferred rendering of openGL
in the UI? for creating and viewing game assets like maps?

maybe you could work together to impliment it in the UI /ainimation suite first
then adapt the code for the bge? roll in OpenES support while your at it.....

I wish I were a better coder so I could help, but I am still learning,

I would love to see support for deferred rendering, would it simplify the rendering code or complicate it more? would the core dvelopers need deferred rendering of openGL in the UI? for creating and viewing game assets like maps? maybe you could work together to impliment it in the UI /ainimation suite first then adapt the code for the bge? roll in OpenES support while your at it..... I wish I were a better coder so I could help, but I am still learning,

Removed subscriber: @mahalin

Removed subscriber: @mahalin
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Aaron Carlisle self-assigned this 2019-06-29 02:15:52 +02:00
Member

This task is being closed because the BGE has been removed in Blender 2.8.

This task is being closed because the BGE has been removed in Blender 2.8.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#40086
No description provided.