Cycles: Add Support for IES files as textures for light strength
authorLukas Stockner <lukas.stockner@freenet.de>
Sat, 26 May 2018 22:46:37 +0000 (00:46 +0200)
committerLukas Stockner <lukas.stockner@freenet.de>
Sat, 26 May 2018 23:24:57 +0000 (01:24 +0200)
commit48155c210a3fd65f6fc2b5be3357b47a8af3711a
treea937261c81b959a79e8a2521a44b87a2d73fa749
parentef502854feb6b81119954206bff414d4507f4f3c
Cycles: Add Support for IES files as textures for light strength

This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.

Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.

The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.

The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.

Reviewers: #cycles, dingto, sergey, brecht

Reviewed By: #cycles, dingto, brecht

Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey

Differential Revision: https://developer.blender.org/D1543
39 files changed:
intern/cycles/blender/blender_shader.cpp
intern/cycles/blender/blender_util.h
intern/cycles/graph/node_type.h
intern/cycles/kernel/CMakeLists.txt
intern/cycles/kernel/kernel_light.h
intern/cycles/kernel/kernel_textures.h
intern/cycles/kernel/osl/osl_services.cpp
intern/cycles/kernel/shaders/CMakeLists.txt
intern/cycles/kernel/shaders/node_ies_light.osl [new file with mode: 0644]
intern/cycles/kernel/svm/svm.h
intern/cycles/kernel/svm/svm_ies.h [new file with mode: 0644]
intern/cycles/kernel/svm/svm_types.h
intern/cycles/render/graph.cpp
intern/cycles/render/light.cpp
intern/cycles/render/light.h
intern/cycles/render/nodes.cpp
intern/cycles/render/nodes.h
intern/cycles/render/osl.cpp
intern/cycles/render/osl.h
intern/cycles/render/scene.cpp
intern/cycles/render/scene.h
intern/cycles/render/svm.cpp
intern/cycles/render/svm.h
intern/cycles/util/CMakeLists.txt
intern/cycles/util/util_ies.cpp [new file with mode: 0644]
intern/cycles/util/util_ies.h [new file with mode: 0644]
intern/cycles/util/util_math.h
release/scripts/startup/nodeitems_builtins.py
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/intern/bpath.c
source/blender/blenkernel/intern/node.c
source/blender/editors/space_node/drawnode.c
source/blender/makesdna/DNA_node_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_nodetree.c
source/blender/nodes/CMakeLists.txt
source/blender/nodes/NOD_shader.h
source/blender/nodes/NOD_static_types.h
source/blender/nodes/shader/nodes/node_shader_ies_light.c [new file with mode: 0644]