# Eevee-next world shader
**Issue**: [105649](https://projects.blender.org/blender/blender/issues/105649)
```mermaid
classDiagram
class World {
DefaultWorldNodeTree default_world_get()
sync()
}
class DefaultWorldNodeTree {
}
class Instance {
+World world
+PipelineModule pipelines
}
class PipelineModule {
}
class WorldPipeline {
PassSimple world_ps_
void sync()
coid render()
}
Instance --> World: world
Instance --> PipelineModule: pipelines
PipelineModule --> WorldPipeline: world
```
## Current state
### High level
* [x] The world background is drawn
* [x] A default node-tree is used when use_nodes is not checked
* [x] The world node-tree is used when use_nodes is checked
* [x] Resources are attached for custom node trees
* [ ] An internal Node tree is generated when viewport `Scene World` is not checked
* [ ] Render world cube map.
* [ ] Coordinates are incorrect when using an environment texture node.
* [x] Is that because matrices in `_drw_view_` are all 0 (no)
* [ ] P (world position is 0,0,0, but legacy eevee contains the actual viewport position)
* Eevee-legacy uses (x,y,0), Eevee-next uses (x,y,1) `interp.P = project_point(ProjectionMatrixInverse, gl_Position.xyz);``
* When setting the camera to the origin the environment texture is rendered correctly. So assuming that this is failing.
* [ ] Legacy Eevee contains viewPosition, not sure to which component that translate to in Eevee-next.
* **Although this is an issue, we postpone it for now and place the camera at the origin**
*
### Med level
* [ ]
## Approach
* Add a CubemapModule that will record the cubemap from the world shader.
* The cubemap module keeps track of multiple cubemaps. The first slot is always the world
*
* Use a compute shader
* Incorporate the cubemap module with the deferred lighting pass
* Incorporate the cubemap module with the forward lighting pass
* Assume that the world is always rendered from scene origin.
```mermaid
classDiagram
class World {
sync()
GPUMaterial* get_world_material()
}
class Instance {
+World world
+PipelineModule pipelines
}
class PipelineModule {
}
class ReflectionProbeModule {
+set_world_dirty()
}
class WorldProbePipeline {
PassSimple world_ps_
void sync()
coid render()
}
Instance --> ReflectionProbeModule: reflection_probes
Instance --> World: world
Instance --> PipelineModule: pipelines
PipelineModule --> WorldProbePipeline: world_probe
```
```mermaid
sequenceDiagram
participant Instance
participant World
participant ReflectionProbeModule
participant WorldProbePipeline
Note over Instance: sync
activate Instance
Instance ->>+ World: sync
World ->>+ ReflectionProbeModule: set_world_dirty
deactivate ReflectionProbeModule
deactivate World
Instance ->>+ ReflectionProbeModule: sync
ReflectionProbeModule ->>+ World: get_world_material()
World -->>- ReflectionProbeModule: GPUMaterial*
ReflectionProbeModule ->>+ WorldProbePipeline: sync(world_material)
deactivate WorldProbePipeline
deactivate ReflectionProbeModule
deactivate Instance
Note over Instance: render
activate Instance
Instance ->>+ WorldProbePipeline: render
deactivate WorldProbePipeline
deactivate Instance
```