Left in the dark #59361

Closed
opened 2018-12-14 12:07:25 +01:00 by TWINGSISTER · 2 comments

System Information
Operating system:windows 10 pro 32 bit
Graphics card:ati radeon 3000

Blender Version
Broken:
(example: 2.79b release)
(example: 2.80, edbf15d3c0, blender2.8, 2018-11-28, as found on the splash screen)
Worked: (optional)blender-2.80.0-git.aca13040dac-windows32

Short description of error
does not start, no message give even if starting it with console and as admin...?
Exact steps for others to reproduce the error
Based on the default startup or an attached .blend file (as simple as possible).
download and run (on my system)
Basically
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0066.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0066.frag
GPUShader: compile error:
shader string 1
1 #version 330
shader string 2
shader string 3
2 #define GPU_ATI
shader string 4
bla bla bla

388 #endif
389
390 fragColor = vec4(shaded_color, 1.0);
391 }
Fragment shader failed to compile with the following errors:
WARNING: 4:88: warning(#283) Implicit cast from int to uint
ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int'
ERROR: error(#273) 1 compilation errors. No code generated
whole transcript follows

F:\DesktopEverywhere\blender-2.80.0-git.aca13040dac-windows32>blender --debug-all
Switching to fully guarded memory allocator.
read file

Version 280 sub 24 date unknown hash unknown

DEG::anonymous-namespace'::deg_graph_id_tag_update: id=SCScene flags=LEGACY_0 AL lib: (EE) UpdateDeviceParams: Failed to set 48000hz, got 44100hz instead ED_screen_refresh: set screen DEG::anonymous-namespace'::deg_graph_id_tag_update: id=SCScene flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=OBCube flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=MECube flags=LEGACY_0
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=MAMaterial flags=COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=NTShader Nodetree flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=NTShader Nodetree flags=COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=MECube flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=OBLight flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=LALight flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=OBCamera flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=CACamera flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=GRMaster Collection flags=COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=GRCollection flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=WOWorld flags=COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=SCScene flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=OBCube flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=MECube flags=LEGACY_0
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=MAMaterial flags=COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=NTShader Nodetree flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=NTShader Nodetree flags=COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=MECube flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=OBLight flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=LALight flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=OBCamera flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=CACamera flags=COPY_ON_WRITE
DEG::anonymous-namespace'::deg_graph_id_tag_update: id=GRMaster Collection flags=COPY_ON_WRITE DEG::anonymous-namespace'::deg_graph_id_tag_update: id=GRCollection flags=COPY_ON_WRITE
DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=WOWorld flags=COPY_ON_WRITE
Depsgraph built in 0.178116 seconds.
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: PLACEHOLDER(Eval Init)
[SCScene :: View Layer]: Operation is entry point for update: GEOMETRY_SELECT_UPDATE()
[SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_OBJECT_UBEREVAL()
[SCScene :: View Layer]: Operation is entry point for update: PLACEHOLDER(Eval Done)
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_LOCAL()
[SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_LOCAL()
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: PLACEHOLDER(Scene Eval)
[SCScene :: View Layer]: Operation is entry point for update: PARAMETERS_EVAL()
[SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_OBJECT_UBEREVAL()
[SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_FINAL()
[SCScene :: View Layer]: Operation is entry point for update: VIEW_LAYER_EVAL()
[SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_FINAL()
[SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_LOCAL()
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_FINAL()
[SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_OBJECT_UBEREVAL()
[SCScene :: View Layer]: Operation is entry point for update: GEOMETRY_UBEREVAL()
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: PLACEHOLDER(Geometry Eval)
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE()
[SCScene :: View Layer]: Accumulated recalc bits for SCScene: 128
[SCScene :: View Layer]: Accumulated recalc bits for OBCube: 387
[SCScene :: View Layer]: Accumulated recalc bits for MAMaterial: 384
[SCScene :: View Layer]: Accumulated recalc bits for NTShader Nodetree: 128
[SCScene :: View Layer]: Accumulated recalc bits for MECube: 4294967171
[SCScene :: View Layer]: Accumulated recalc bits for OBLight: 131
[SCScene :: View Layer]: Accumulated recalc bits for LALight: 128
[SCScene :: View Layer]: Accumulated recalc bits for OBCamera: 131
[SCScene :: View Layer]: Accumulated recalc bits for CACamera: 128
[SCScene :: View Layer]: Accumulated recalc bits for GRMaster Collection: 128
[SCScene :: View Layer]: Accumulated recalc bits for GRCollection: 128
[SCScene :: View Layer]: Accumulated recalc bits for WOWorld: 128
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on WOWorld (08F7C840)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on GRCollection (08F02190)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on GRMaster Collection (08F00930)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on CACamera (08F5D2E0)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on LALight (08F36458)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on MECube (090D7210)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on OBCamera (090D7C50)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on OBLight (090D7790)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on OBCube (08F5CC90)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on NTShader Nodetree (08F5D150)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on SCScene (08FD14A8)
[SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on MAMaterial (08FEC5F0)
[SCScene :: View Layer]: BKE_layer_eval_view_layer on View Layer (0C760020)
[SCScene :: View Layer]: BKE_object_eval_local_transform on OBLight (090D7790)
[SCScene :: View Layer]: BKE_object_eval_local_transform on OBCamera (090D7C50)
[SCScene :: View Layer]: BKE_object_eval_flush_base_flags on OBCube (08F5CC90)
[SCScene :: View Layer]: BKE_object_eval_transform_final on OBLight (090D7790)
[SCScene :: View Layer]: BKE_object_eval_transform_final on OBCamera (090D7C50)
[SCScene :: View Layer]: BKE_object_eval_flush_base_flags on OBCamera (090D7C50)
[SCScene :: View Layer]: BKE_object_eval_flush_base_flags on OBLight (090D7790)
[SCScene :: View Layer]: BKE_object_data_select_update on MECube (090D7210)
[SCScene :: View Layer]: BKE_mesh_eval_geometry on MECube (090D7210)
[SCScene :: View Layer]: BKE_material_eval on MAMaterial (08FEC5F0)
[SCScene :: View Layer]: BKE_object_eval_local_transform on OBCube (08F5CC90)
[SCScene :: View Layer]: BKE_object_eval_uber_data on OBCube (08F5CC90)
[SCScene :: View Layer]: BKE_object_eval_transform_final on OBCube (08F5CC90)
[SCScene :: View Layer]: BKE_object_handle_data_update on OBCube (08F5CC90)
[SCScene :: View Layer]: BKE_object_eval_update_shading on OBCube (08F5CC90)
Depsgraph updated in 0.083674 seconds.
found bundled python: F:\DesktopEverywhere\blender-2.80.0-git.aca13040dac-windows32\2.80\python
time bl_operators 0.1929
time bl_ui 0.6596
time keyingsets_builtins 0.0141
time nodeitems_builtins 0.0176
bl_app_template_utils.reset('')

      addon_utils.enable io_scene_fbx
      addon_utils.enable io_anim_bvh
      addon_utils.enable io_mesh_ply
      addon_utils.enable io_scene_obj
      addon_utils.enable io_mesh_stl
      addon_utils.enable io_mesh_uv_layout
      addon_utils.enable io_curve_svg

I1214 12:17:25.350327 2656 blender_python.cpp:189] Debug flags initialized to:
CPU flags:

AVX2       : True
AVX        : True
SSE4.1     : True
SSE3       : True
SSE2       : True
BVH layout : BVH8
Split      : False

CUDA flags:
Adaptive Compile: False
OpenCL flags:

Device type    : ALL
Kernel type    : DEFAULT
Debug          : False
Single program : True
Memory limit   : 0
      addon_utils.enable cycles
      addon_utils.enable io_scene_gltf2

Python Script Load Time 1.2767
Warning, unregistered class: Import3DS(Operator)
Warning, unregistered class: Export3DS(Operator)
Warning, unregistered class: ImportX3D(Operator)
Warning, unregistered class: ExportX3D(Operator)
Warning, unregistered class: PresetMenu(Panel)
Warning, unregistered class: PARTICLE_PT_render_billboards_alignment(Panel)
Warning, unregistered class: VIEW3D_PT_tools_grease_pencil_edit(Panel)
Warning, unregistered class: CYCLES_RENDER_PT_sampling_total(Panel)
Warning, unregistered class: MASK_MT_add(Menu)
loading preset: F:\DesktopEverywhere\blender-2.80.0-git.aca13040dac-windows32\2.80\scripts\presets\keyconfig\blender.py
FRS_set_context: context 0x05542C10 scene 0x08FF0AA0
UI_menutype_draw: opening menu "WM_MT_splash"
ghost_event_proc: window 1 state = normal
ED_screen_refresh: set screen
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0001.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0001.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0001.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0002.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0002.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0003.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0003.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0004.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0004.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0005.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0005.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0006.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0006.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0007.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0007.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0008.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0008.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0009.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0009.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0010.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0010.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0010.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0011.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0011.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0011.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0012.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0012.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0012.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0013.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0013.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0013.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0014.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0014.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0014.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0015.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0015.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0015.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0016.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0016.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0017.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0017.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0018.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0018.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0019.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0019.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0020.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0020.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0020.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0021.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0021.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0022.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0022.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0022.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0023.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0023.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0024.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0024.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0024.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0025.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0025.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0026.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0026.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0027.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0027.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0028.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0028.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0029.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0029.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0030.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0030.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0031.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0031.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0032.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0032.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0033.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0033.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0034.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0034.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0035.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0035.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0036.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0036.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0037.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0037.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0038.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0038.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0039.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0039.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0039.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0040.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0040.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0040.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0041.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0041.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0041.geom
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0042.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0042.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0043.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0043.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0044.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0044.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0045.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0045.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0046.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0046.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0047.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0047.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0048.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0048.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0049.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0049.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0050.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0050.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0051.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0051.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0052.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0052.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0053.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0053.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0054.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0054.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0055.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0055.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0056.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0056.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0057.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0057.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0058.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0058.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0059.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0059.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0060.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0060.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0061.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0061.frag
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0062.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0062.frag
GPUShader: compile error:
shader string 1
1 #version 330
shader string 2
shader string 3
2 #define GPU_ATI
shader string 4
3 #define V3D_SHADING_OBJECT_OUTLINE
4 #define V3D_SHADING_SPECULAR_HIGHLIGHT
5 #define V3D_LIGHTING_STUDIO
6 #define OBJECT_ID_PASS_ENABLED
7 #define MATDATA_PASS_ENABLED
8 #define NORMAL_VIEWPORT_PASS_ENABLED
9 #define WORKBENCH_ENCODE_NORMALS
shader string 5
10 struct LightData {
11 vec4 direction;
12 vec4 specular_color;
13 vec4 diffuse_color_wrap; /* rgb: diffuse col a: wrapped lighting factor /
14 };
15
16 struct WorldData {
17 vec4 background_color_low;
18 vec4 background_color_high;
19 vec4 object_outline_color;
20 vec4 shadow_direction_vs;
21 LightData lights[4];
22 vec4 ambient_color;
23 int num_lights;
24 int matcap_orientation;
25 float background_alpha;
26 float curvature_ridge;
27 float curvature_valley;
28 int pad[3];
29 };
30 #define NO_OBJECT_ID uint(0)
31 #define EPSILON 0.00001
32 #define M_PI 3.14159265358979323846
33
34 #define CAVITY_BUFFER_RANGE 4.0
35
36 /
4x4 bayer matrix prepared for 8bit UNORM precision error. /
37 #define P(x) (((x + 0.5) * (1.0 / 16.0) - 0.5) * (1.0 / 255.0))
38 const vec4 dither_mat4x4- [x] = vec4[4](
39 vec4( P(0.0), P(8.0), P(2.0), P(10.0)),
40 vec4(P(12.0), P(4.0), P(14.0), P(6.0)),
41 vec4( P(3.0), P(11.0), P(1.0), P(9.0)),
42 vec4(P(15.0), P(7.0), P(13.0), P(5.0))
43 );
44
45 float bayer_dither_noise() {
46 ivec2 tx1 = ivec2(gl_FragCoord.xy) % 4;
47 ivec2 tx2 = ivec2(gl_FragCoord.xy) % 2;
48 return dither_mat4x4[tx1.x][tx1.y];
49 }
50
51 #ifdef WORKBENCH_ENCODE_NORMALS
52
53 #define WB_Normal vec2
54
55 /
From http://aras-p.info/texts/CompactNormalStorage.html
56 * Using Method #4: Spheremap Transform /
57 vec3 workbench_normal_decode(WB_Normal enc)
58 {
59 vec2 fenc = enc.xy * 4.0 - 2.0;
60 float f = dot(fenc, fenc);
61 float g = sqrt(1.0 - f / 4.0);
62 vec3 n;
63 n.xy = fenc
g;
64 n.z = 1 - f / 2;
65 return n;
66 }
67
68 /* From http://aras-p.info/texts/CompactNormalStorage.html
69 * Using Method #4: Spheremap Transform /
70 WB_Normal workbench_normal_encode(vec3 n)
71 {
72 float p = sqrt(n.z * 8.0 + 8.0);
73 n.xy = clamp(n.xy / p + 0.5, 0.0, 1.0);
74 return n.xy;
75 }
76
77 #else
78 #define WB_Normal vec3
79 /
Well just do nothing... /
80 # define workbench_normal_encode(a) (a)
81 # define workbench_normal_decode(a) (a)
82 #endif /
WORKBENCH_ENCODE_NORMALS /
83
84 /
Encoding into the alpha of a RGBA8 UNORM texture. /
85 #define TARGET_BITCOUNT 8u
86 #define METALLIC_BITS 3u /
Metallic channel is less important. /
87 #define ROUGHNESS_BITS (TARGET_BITCOUNT - METALLIC_BITS)
88 #define TOTAL_BITS (METALLIC_BITS + ROUGHNESS_BITS)
89
90 /
Encode 2 float into 1 with the desired precision. /
91 float workbench_float_pair_encode(float v1, float v2)
92 {
93 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS);
94 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
95 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
96 int iv1 = int(v1 * float(v1_mask));
97 int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS;
98 return float(iv1 | iv2) * (1.0 / float(total_mask));
99 }
100
101 void workbench_float_pair_decode(float data, out float v1, out float v2)
102 {
103 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS);
104 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
105 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
106 uint idata = uint(data * float(total_mask));
107 v1 = float(idata & v1_mask) * (1.0 / float(v1_mask));
108 v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask));
109 }
110
111 float calculate_transparent_weight(float z, float alpha)
112 {
113 #if 0
114 /
Eq 10 : Good for surfaces with varying opacity (like particles) /
115 float a = min(1.0, alpha * 10.0) + 0.01;
116 float b = -gl_FragCoord.z * 0.95 + 1.0;
117 float w = a * a * a * 3e2 * b * b * b;
118 #else
119 /
Eq 7 put more emphasis on surfaces closer to the view. /
120 // float w = 10.0 / (1e-5 + pow(abs(z) / 5.0, 2.0) + pow(abs(z) / 200.0, 6.0)); /
Eq 7 /
121 // float w = 10.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0)); /
Eq 8 /
122 // float w = 10.0 / (1e-5 + pow(abs(z) / 200.0, 4.0)); /
Eq 9 /
123 /
Same as eq 7, but optimized. */
124 float a = abs(z) / 5.0;
125 float b = abs(z) / 200.0;
126 b = b;
127 float w = 10.0 / ((1e-5 + a * a) + b * (b * b)); /
Eq 7 /
128 #endif
129 return alpha * clamp(w, 1e-2, 3e2);
130 }
131
132 /
Special function only to be used with calculate_transparent_weight(). /
133 float linear_zdepth(float depth, vec4 viewvecs- [x], mat4 proj_mat)
134 {
135 if (proj_mat- [x]- [x] == 0.0) {
136 float d = 2.0 * depth - 1.0;
137 return -proj_mat- [x]- [x] / (d + proj_mat- [x][2]);
138 }
139 else {
140 /
Return depth from near plane. /
141 return depth * viewvecs- [x].z;
142 }
143 }
144
145 vec3 view_vector_from_screen_uv(vec2 uv, vec4 viewvecs- [x], mat4 proj_mat)
146 {
147 return (proj_mat- [x]- [x] == 0.0)
148 ? normalize(viewvecs- [x].xyz + vec3(uv, 0.0) * viewvecs- [x].xyz)
149 : vec3(0.0, 0.0, 1.0);
150 }
151
152 vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped)
153 {
154 /
Quick creation of an orthonormal basis /
155 float a = 1.0 / (1.0 + I.z);
156 float b = -I.x * I.y * a;
157 vec3 b1 = vec3(1.0 - I.x * I.x * a, b, -I.x);
158 vec3 b2 = vec3(b, 1.0 - I.y * I.y * a, -I.y);
159 vec2 matcap_uv = vec2(dot(b1, N), dot(b2, N));
160 if (flipped) {
161 matcap_uv.x = -matcap_uv.x;
162 }
163 return matcap_uv * 0.496 + 0.5;
164 }
165 uniform int object_id = 0;
166
167 uniform vec3 materialDiffuseColor;
168 uniform float materialMetallic;
169 uniform float materialRoughness;
170
171 uniform sampler2D image;
172 uniform float ImageTransparencyCutoff = 0.1;
173
174 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
175 in vec3 normal_viewport;
176 #endif
177
178 #ifdef V3D_SHADING_TEXTURE_COLOR
179 in vec2 uv_interp;
180 #endif
181
182 #ifdef HAIR_SHADER
183 flat in float hair_rand;
184 #endif
185
186 #ifdef MATDATA_PASS_ENABLED
187 layout(location=0) out vec4 materialData;
188 #endif
189 #ifdef OBJECT_ID_PASS_ENABLED
190 layout(location=1) out uint objectId;
191 #endif
192 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
193 layout(location=2) out WB_Normal normalViewport;
194 #endif
195
196 void main()
197 {
198 #ifdef MATDATA_PASS_ENABLED
199 float metallic, roughness;
200 vec4 color;
201
202 # ifdef V3D_SHADING_TEXTURE_COLOR
203 color = texture(image, uv_interp);
204 if (color.a < ImageTransparencyCutoff) {
205 discard;
206 }
207 # else
208 color.rgb = materialDiffuseColor;
209 # endif
210
211 # ifdef V3D_LIGHTING_MATCAP
212 /
Encode front facing in metallic channel. /
213 metallic = float(gl_FrontFacing);
214 roughness = 0.0;
215 # else
216 metallic = materialMetallic;
217 roughness = materialRoughness;
218 # endif
219
220 # ifdef HAIR_SHADER
221 /
Add some variation to the hairs to avoid uniform look. /
222 float hair_variation = hair_rand * 0.1;
223 color = clamp(color - hair_variation, 0.0, 1.0);
224 metallic = clamp(materialMetallic - hair_variation, 0.0, 1.0);
225 roughness = clamp(materialRoughness - hair_variation, 0.0, 1.0);
226 # endif
227
228 materialData.rgb = color.rgb;
229 materialData.a = workbench_float_pair_encode(roughness, metallic);
230 #endif /
MATDATA_PASS_ENABLED */
231
232 #ifdef OBJECT_ID_PASS_ENABLED
233 objectId = uint(object_id);
234 #endif
235
236 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
237 vec3 n = (gl_FrontFacing) ? normal_viewport : -normal_viewport;
238 n = normalize(n);
239 normalViewport = workbench_normal_encode(n);
240 #endif
241 }
Fragment shader failed to compile with the following errors:
WARNING: 4:88: warning(#283) Implicit cast from int to uint
ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int'
ERROR: error(#273) 1 compilation errors. No code generated

Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0063.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0063.frag
GPUShader: compile error:
shader string 1
1 #version 330
shader string 2
shader string 3
2 #define GPU_ATI
shader string 4
3 #define V3D_SHADING_OBJECT_OUTLINE
4 #define V3D_SHADING_SPECULAR_HIGHLIGHT
5 #define V3D_LIGHTING_STUDIO
6 #define OBJECT_ID_PASS_ENABLED
7 #define MATDATA_PASS_ENABLED
8 #define NORMAL_VIEWPORT_PASS_ENABLED
9 #define WORKBENCH_ENCODE_NORMALS
10 #define HAIR_SHADER
shader string 5
11 struct LightData {
12 vec4 direction;
13 vec4 specular_color;
14 vec4 diffuse_color_wrap; /* rgb: diffuse col a: wrapped lighting factor /
15 };
16
17 struct WorldData {
18 vec4 background_color_low;
19 vec4 background_color_high;
20 vec4 object_outline_color;
21 vec4 shadow_direction_vs;
22 LightData lights[4];
23 vec4 ambient_color;
24 int num_lights;
25 int matcap_orientation;
26 float background_alpha;
27 float curvature_ridge;
28 float curvature_valley;
29 int pad[3];
30 };
31 #define NO_OBJECT_ID uint(0)
32 #define EPSILON 0.00001
33 #define M_PI 3.14159265358979323846
34
35 #define CAVITY_BUFFER_RANGE 4.0
36
37 /
4x4 bayer matrix prepared for 8bit UNORM precision error. /
38 #define P(x) (((x + 0.5) * (1.0 / 16.0) - 0.5) * (1.0 / 255.0))
39 const vec4 dither_mat4x4- [x] = vec4[4](
40 vec4( P(0.0), P(8.0), P(2.0), P(10.0)),
41 vec4(P(12.0), P(4.0), P(14.0), P(6.0)),
42 vec4( P(3.0), P(11.0), P(1.0), P(9.0)),
43 vec4(P(15.0), P(7.0), P(13.0), P(5.0))
44 );
45
46 float bayer_dither_noise() {
47 ivec2 tx1 = ivec2(gl_FragCoord.xy) % 4;
48 ivec2 tx2 = ivec2(gl_FragCoord.xy) % 2;
49 return dither_mat4x4[tx1.x][tx1.y];
50 }
51
52 #ifdef WORKBENCH_ENCODE_NORMALS
53
54 #define WB_Normal vec2
55
56 /
From http://aras-p.info/texts/CompactNormalStorage.html
57 * Using Method #4: Spheremap Transform /
58 vec3 workbench_normal_decode(WB_Normal enc)
59 {
60 vec2 fenc = enc.xy * 4.0 - 2.0;
61 float f = dot(fenc, fenc);
62 float g = sqrt(1.0 - f / 4.0);
63 vec3 n;
64 n.xy = fenc
g;
65 n.z = 1 - f / 2;
66 return n;
67 }
68
69 /* From http://aras-p.info/texts/CompactNormalStorage.html
70 * Using Method #4: Spheremap Transform /
71 WB_Normal workbench_normal_encode(vec3 n)
72 {
73 float p = sqrt(n.z * 8.0 + 8.0);
74 n.xy = clamp(n.xy / p + 0.5, 0.0, 1.0);
75 return n.xy;
76 }
77
78 #else
79 #define WB_Normal vec3
80 /
Well just do nothing... /
81 # define workbench_normal_encode(a) (a)
82 # define workbench_normal_decode(a) (a)
83 #endif /
WORKBENCH_ENCODE_NORMALS /
84
85 /
Encoding into the alpha of a RGBA8 UNORM texture. /
86 #define TARGET_BITCOUNT 8u
87 #define METALLIC_BITS 3u /
Metallic channel is less important. /
88 #define ROUGHNESS_BITS (TARGET_BITCOUNT - METALLIC_BITS)
89 #define TOTAL_BITS (METALLIC_BITS + ROUGHNESS_BITS)
90
91 /
Encode 2 float into 1 with the desired precision. /
92 float workbench_float_pair_encode(float v1, float v2)
93 {
94 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS);
95 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
96 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
97 int iv1 = int(v1 * float(v1_mask));
98 int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS;
99 return float(iv1 | iv2) * (1.0 / float(total_mask));
100 }
101
102 void workbench_float_pair_decode(float data, out float v1, out float v2)
103 {
104 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS);
105 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
106 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
107 uint idata = uint(data * float(total_mask));
108 v1 = float(idata & v1_mask) * (1.0 / float(v1_mask));
109 v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask));
110 }
111
112 float calculate_transparent_weight(float z, float alpha)
113 {
114 #if 0
115 /
Eq 10 : Good for surfaces with varying opacity (like particles) /
116 float a = min(1.0, alpha * 10.0) + 0.01;
117 float b = -gl_FragCoord.z * 0.95 + 1.0;
118 float w = a * a * a * 3e2 * b * b * b;
119 #else
120 /
Eq 7 put more emphasis on surfaces closer to the view. /
121 // float w = 10.0 / (1e-5 + pow(abs(z) / 5.0, 2.0) + pow(abs(z) / 200.0, 6.0)); /
Eq 7 /
122 // float w = 10.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0)); /
Eq 8 /
123 // float w = 10.0 / (1e-5 + pow(abs(z) / 200.0, 4.0)); /
Eq 9 /
124 /
Same as eq 7, but optimized. */
125 float a = abs(z) / 5.0;
126 float b = abs(z) / 200.0;
127 b = b;
128 float w = 10.0 / ((1e-5 + a * a) + b * (b * b)); /
Eq 7 /
129 #endif
130 return alpha * clamp(w, 1e-2, 3e2);
131 }
132
133 /
Special function only to be used with calculate_transparent_weight(). /
134 float linear_zdepth(float depth, vec4 viewvecs- [x], mat4 proj_mat)
135 {
136 if (proj_mat- [x]- [x] == 0.0) {
137 float d = 2.0 * depth - 1.0;
138 return -proj_mat- [x]- [x] / (d + proj_mat- [x][2]);
139 }
140 else {
141 /
Return depth from near plane. /
142 return depth * viewvecs- [x].z;
143 }
144 }
145
146 vec3 view_vector_from_screen_uv(vec2 uv, vec4 viewvecs- [x], mat4 proj_mat)
147 {
148 return (proj_mat- [x]- [x] == 0.0)
149 ? normalize(viewvecs- [x].xyz + vec3(uv, 0.0) * viewvecs- [x].xyz)
150 : vec3(0.0, 0.0, 1.0);
151 }
152
153 vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped)
154 {
155 /
Quick creation of an orthonormal basis /
156 float a = 1.0 / (1.0 + I.z);
157 float b = -I.x * I.y * a;
158 vec3 b1 = vec3(1.0 - I.x * I.x * a, b, -I.x);
159 vec3 b2 = vec3(b, 1.0 - I.y * I.y * a, -I.y);
160 vec2 matcap_uv = vec2(dot(b1, N), dot(b2, N));
161 if (flipped) {
162 matcap_uv.x = -matcap_uv.x;
163 }
164 return matcap_uv * 0.496 + 0.5;
165 }
166 uniform int object_id = 0;
167
168 uniform vec3 materialDiffuseColor;
169 uniform float materialMetallic;
170 uniform float materialRoughness;
171
172 uniform sampler2D image;
173 uniform float ImageTransparencyCutoff = 0.1;
174
175 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
176 in vec3 normal_viewport;
177 #endif
178
179 #ifdef V3D_SHADING_TEXTURE_COLOR
180 in vec2 uv_interp;
181 #endif
182
183 #ifdef HAIR_SHADER
184 flat in float hair_rand;
185 #endif
186
187 #ifdef MATDATA_PASS_ENABLED
188 layout(location=0) out vec4 materialData;
189 #endif
190 #ifdef OBJECT_ID_PASS_ENABLED
191 layout(location=1) out uint objectId;
192 #endif
193 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
194 layout(location=2) out WB_Normal normalViewport;
195 #endif
196
197 void main()
198 {
199 #ifdef MATDATA_PASS_ENABLED
200 float metallic, roughness;
201 vec4 color;
202
203 # ifdef V3D_SHADING_TEXTURE_COLOR
204 color = texture(image, uv_interp);
205 if (color.a < ImageTransparencyCutoff) {
206 discard;
207 }
208 # else
209 color.rgb = materialDiffuseColor;
210 # endif
211
212 # ifdef V3D_LIGHTING_MATCAP
213 /
Encode front facing in metallic channel. /
214 metallic = float(gl_FrontFacing);
215 roughness = 0.0;
216 # else
217 metallic = materialMetallic;
218 roughness = materialRoughness;
219 # endif
220
221 # ifdef HAIR_SHADER
222 /
Add some variation to the hairs to avoid uniform look. /
223 float hair_variation = hair_rand * 0.1;
224 color = clamp(color - hair_variation, 0.0, 1.0);
225 metallic = clamp(materialMetallic - hair_variation, 0.0, 1.0);
226 roughness = clamp(materialRoughness - hair_variation, 0.0, 1.0);
227 # endif
228
229 materialData.rgb = color.rgb;
230 materialData.a = workbench_float_pair_encode(roughness, metallic);
231 #endif /
MATDATA_PASS_ENABLED */
232
233 #ifdef OBJECT_ID_PASS_ENABLED
234 objectId = uint(object_id);
235 #endif
236
237 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
238 vec3 n = (gl_FrontFacing) ? normal_viewport : -normal_viewport;
239 n = normalize(n);
240 normalViewport = workbench_normal_encode(n);
241 #endif
242 }
Fragment shader failed to compile with the following errors:
WARNING: 4:88: warning(#283) Implicit cast from int to uint
ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int'
ERROR: error(#273) 1 compilation errors. No code generated

Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0064.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0064.frag
GPUShader: compile error:
shader string 1
1 #version 330
shader string 2
shader string 3
2 #define GPU_ATI
shader string 4
3 #define V3D_SHADING_OBJECT_OUTLINE
4 #define V3D_SHADING_SPECULAR_HIGHLIGHT
5 #define V3D_LIGHTING_STUDIO
6 #define OBJECT_ID_PASS_ENABLED
7 #define MATDATA_PASS_ENABLED
8 #define NORMAL_VIEWPORT_PASS_ENABLED
9 #define V3D_SHADING_TEXTURE_COLOR
10 #define WORKBENCH_ENCODE_NORMALS
shader string 5
11 struct LightData {
12 vec4 direction;
13 vec4 specular_color;
14 vec4 diffuse_color_wrap; /* rgb: diffuse col a: wrapped lighting factor /
15 };
16
17 struct WorldData {
18 vec4 background_color_low;
19 vec4 background_color_high;
20 vec4 object_outline_color;
21 vec4 shadow_direction_vs;
22 LightData lights[4];
23 vec4 ambient_color;
24 int num_lights;
25 int matcap_orientation;
26 float background_alpha;
27 float curvature_ridge;
28 float curvature_valley;
29 int pad[3];
30 };
31 #define NO_OBJECT_ID uint(0)
32 #define EPSILON 0.00001
33 #define M_PI 3.14159265358979323846
34
35 #define CAVITY_BUFFER_RANGE 4.0
36
37 /
4x4 bayer matrix prepared for 8bit UNORM precision error. /
38 #define P(x) (((x + 0.5) * (1.0 / 16.0) - 0.5) * (1.0 / 255.0))
39 const vec4 dither_mat4x4- [x] = vec4[4](
40 vec4( P(0.0), P(8.0), P(2.0), P(10.0)),
41 vec4(P(12.0), P(4.0), P(14.0), P(6.0)),
42 vec4( P(3.0), P(11.0), P(1.0), P(9.0)),
43 vec4(P(15.0), P(7.0), P(13.0), P(5.0))
44 );
45
46 float bayer_dither_noise() {
47 ivec2 tx1 = ivec2(gl_FragCoord.xy) % 4;
48 ivec2 tx2 = ivec2(gl_FragCoord.xy) % 2;
49 return dither_mat4x4[tx1.x][tx1.y];
50 }
51
52 #ifdef WORKBENCH_ENCODE_NORMALS
53
54 #define WB_Normal vec2
55
56 /
From http://aras-p.info/texts/CompactNormalStorage.html
57 * Using Method #4: Spheremap Transform /
58 vec3 workbench_normal_decode(WB_Normal enc)
59 {
60 vec2 fenc = enc.xy * 4.0 - 2.0;
61 float f = dot(fenc, fenc);
62 float g = sqrt(1.0 - f / 4.0);
63 vec3 n;
64 n.xy = fenc
g;
65 n.z = 1 - f / 2;
66 return n;
67 }
68
69 /* From http://aras-p.info/texts/CompactNormalStorage.html
70 * Using Method #4: Spheremap Transform /
71 WB_Normal workbench_normal_encode(vec3 n)
72 {
73 float p = sqrt(n.z * 8.0 + 8.0);
74 n.xy = clamp(n.xy / p + 0.5, 0.0, 1.0);
75 return n.xy;
76 }
77
78 #else
79 #define WB_Normal vec3
80 /
Well just do nothing... /
81 # define workbench_normal_encode(a) (a)
82 # define workbench_normal_decode(a) (a)
83 #endif /
WORKBENCH_ENCODE_NORMALS /
84
85 /
Encoding into the alpha of a RGBA8 UNORM texture. /
86 #define TARGET_BITCOUNT 8u
87 #define METALLIC_BITS 3u /
Metallic channel is less important. /
88 #define ROUGHNESS_BITS (TARGET_BITCOUNT - METALLIC_BITS)
89 #define TOTAL_BITS (METALLIC_BITS + ROUGHNESS_BITS)
90
91 /
Encode 2 float into 1 with the desired precision. /
92 float workbench_float_pair_encode(float v1, float v2)
93 {
94 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS);
95 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
96 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
97 int iv1 = int(v1 * float(v1_mask));
98 int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS;
99 return float(iv1 | iv2) * (1.0 / float(total_mask));
100 }
101
102 void workbench_float_pair_decode(float data, out float v1, out float v2)
103 {
104 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS);
105 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
106 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
107 uint idata = uint(data * float(total_mask));
108 v1 = float(idata & v1_mask) * (1.0 / float(v1_mask));
109 v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask));
110 }
111
112 float calculate_transparent_weight(float z, float alpha)
113 {
114 #if 0
115 /
Eq 10 : Good for surfaces with varying opacity (like particles) /
116 float a = min(1.0, alpha * 10.0) + 0.01;
117 float b = -gl_FragCoord.z * 0.95 + 1.0;
118 float w = a * a * a * 3e2 * b * b * b;
119 #else
120 /
Eq 7 put more emphasis on surfaces closer to the view. /
121 // float w = 10.0 / (1e-5 + pow(abs(z) / 5.0, 2.0) + pow(abs(z) / 200.0, 6.0)); /
Eq 7 /
122 // float w = 10.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0)); /
Eq 8 /
123 // float w = 10.0 / (1e-5 + pow(abs(z) / 200.0, 4.0)); /
Eq 9 /
124 /
Same as eq 7, but optimized. */
125 float a = abs(z) / 5.0;
126 float b = abs(z) / 200.0;
127 b = b;
128 float w = 10.0 / ((1e-5 + a * a) + b * (b * b)); /
Eq 7 /
129 #endif
130 return alpha * clamp(w, 1e-2, 3e2);
131 }
132
133 /
Special function only to be used with calculate_transparent_weight(). /
134 float linear_zdepth(float depth, vec4 viewvecs- [x], mat4 proj_mat)
135 {
136 if (proj_mat- [x]- [x] == 0.0) {
137 float d = 2.0 * depth - 1.0;
138 return -proj_mat- [x]- [x] / (d + proj_mat- [x][2]);
139 }
140 else {
141 /
Return depth from near plane. /
142 return depth * viewvecs- [x].z;
143 }
144 }
145
146 vec3 view_vector_from_screen_uv(vec2 uv, vec4 viewvecs- [x], mat4 proj_mat)
147 {
148 return (proj_mat- [x]- [x] == 0.0)
149 ? normalize(viewvecs- [x].xyz + vec3(uv, 0.0) * viewvecs- [x].xyz)
150 : vec3(0.0, 0.0, 1.0);
151 }
152
153 vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped)
154 {
155 /
Quick creation of an orthonormal basis /
156 float a = 1.0 / (1.0 + I.z);
157 float b = -I.x * I.y * a;
158 vec3 b1 = vec3(1.0 - I.x * I.x * a, b, -I.x);
159 vec3 b2 = vec3(b, 1.0 - I.y * I.y * a, -I.y);
160 vec2 matcap_uv = vec2(dot(b1, N), dot(b2, N));
161 if (flipped) {
162 matcap_uv.x = -matcap_uv.x;
163 }
164 return matcap_uv * 0.496 + 0.5;
165 }
166 uniform int object_id = 0;
167
168 uniform vec3 materialDiffuseColor;
169 uniform float materialMetallic;
170 uniform float materialRoughness;
171
172 uniform sampler2D image;
173 uniform float ImageTransparencyCutoff = 0.1;
174
175 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
176 in vec3 normal_viewport;
177 #endif
178
179 #ifdef V3D_SHADING_TEXTURE_COLOR
180 in vec2 uv_interp;
181 #endif
182
183 #ifdef HAIR_SHADER
184 flat in float hair_rand;
185 #endif
186
187 #ifdef MATDATA_PASS_ENABLED
188 layout(location=0) out vec4 materialData;
189 #endif
190 #ifdef OBJECT_ID_PASS_ENABLED
191 layout(location=1) out uint objectId;
192 #endif
193 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
194 layout(location=2) out WB_Normal normalViewport;
195 #endif
196
197 void main()
198 {
199 #ifdef MATDATA_PASS_ENABLED
200 float metallic, roughness;
201 vec4 color;
202
203 # ifdef V3D_SHADING_TEXTURE_COLOR
204 color = texture(image, uv_interp);
205 if (color.a < ImageTransparencyCutoff) {
206 discard;
207 }
208 # else
209 color.rgb = materialDiffuseColor;
210 # endif
211
212 # ifdef V3D_LIGHTING_MATCAP
213 /
Encode front facing in metallic channel. /
214 metallic = float(gl_FrontFacing);
215 roughness = 0.0;
216 # else
217 metallic = materialMetallic;
218 roughness = materialRoughness;
219 # endif
220
221 # ifdef HAIR_SHADER
222 /
Add some variation to the hairs to avoid uniform look. /
223 float hair_variation = hair_rand * 0.1;
224 color = clamp(color - hair_variation, 0.0, 1.0);
225 metallic = clamp(materialMetallic - hair_variation, 0.0, 1.0);
226 roughness = clamp(materialRoughness - hair_variation, 0.0, 1.0);
227 # endif
228
229 materialData.rgb = color.rgb;
230 materialData.a = workbench_float_pair_encode(roughness, metallic);
231 #endif /
MATDATA_PASS_ENABLED */
232
233 #ifdef OBJECT_ID_PASS_ENABLED
234 objectId = uint(object_id);
235 #endif
236
237 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
238 vec3 n = (gl_FrontFacing) ? normal_viewport : -normal_viewport;
239 n = normalize(n);
240 normalViewport = workbench_normal_encode(n);
241 #endif
242 }
Fragment shader failed to compile with the following errors:
WARNING: 4:88: warning(#283) Implicit cast from int to uint
ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int'
ERROR: error(#273) 1 compilation errors. No code generated

Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0065.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0065.frag
GPUShader: compile error:
shader string 1
1 #version 330
shader string 2
shader string 3
2 #define GPU_ATI
shader string 4
3 #define V3D_SHADING_OBJECT_OUTLINE
4 #define V3D_SHADING_SPECULAR_HIGHLIGHT
5 #define V3D_LIGHTING_STUDIO
6 #define OBJECT_ID_PASS_ENABLED
7 #define MATDATA_PASS_ENABLED
8 #define NORMAL_VIEWPORT_PASS_ENABLED
9 #define V3D_SHADING_TEXTURE_COLOR
10 #define WORKBENCH_ENCODE_NORMALS
11 #define HAIR_SHADER
shader string 5
12 struct LightData {
13 vec4 direction;
14 vec4 specular_color;
15 vec4 diffuse_color_wrap; /* rgb: diffuse col a: wrapped lighting factor /
16 };
17
18 struct WorldData {
19 vec4 background_color_low;
20 vec4 background_color_high;
21 vec4 object_outline_color;
22 vec4 shadow_direction_vs;
23 LightData lights[4];
24 vec4 ambient_color;
25 int num_lights;
26 int matcap_orientation;
27 float background_alpha;
28 float curvature_ridge;
29 float curvature_valley;
30 int pad[3];
31 };
32 #define NO_OBJECT_ID uint(0)
33 #define EPSILON 0.00001
34 #define M_PI 3.14159265358979323846
35
36 #define CAVITY_BUFFER_RANGE 4.0
37
38 /
4x4 bayer matrix prepared for 8bit UNORM precision error. /
39 #define P(x) (((x + 0.5) * (1.0 / 16.0) - 0.5) * (1.0 / 255.0))
40 const vec4 dither_mat4x4- [x] = vec4[4](
41 vec4( P(0.0), P(8.0), P(2.0), P(10.0)),
42 vec4(P(12.0), P(4.0), P(14.0), P(6.0)),
43 vec4( P(3.0), P(11.0), P(1.0), P(9.0)),
44 vec4(P(15.0), P(7.0), P(13.0), P(5.0))
45 );
46
47 float bayer_dither_noise() {
48 ivec2 tx1 = ivec2(gl_FragCoord.xy) % 4;
49 ivec2 tx2 = ivec2(gl_FragCoord.xy) % 2;
50 return dither_mat4x4[tx1.x][tx1.y];
51 }
52
53 #ifdef WORKBENCH_ENCODE_NORMALS
54
55 #define WB_Normal vec2
56
57 /
From http://aras-p.info/texts/CompactNormalStorage.html
58 * Using Method #4: Spheremap Transform /
59 vec3 workbench_normal_decode(WB_Normal enc)
60 {
61 vec2 fenc = enc.xy * 4.0 - 2.0;
62 float f = dot(fenc, fenc);
63 float g = sqrt(1.0 - f / 4.0);
64 vec3 n;
65 n.xy = fenc
g;
66 n.z = 1 - f / 2;
67 return n;
68 }
69
70 /* From http://aras-p.info/texts/CompactNormalStorage.html
71 * Using Method #4: Spheremap Transform /
72 WB_Normal workbench_normal_encode(vec3 n)
73 {
74 float p = sqrt(n.z * 8.0 + 8.0);
75 n.xy = clamp(n.xy / p + 0.5, 0.0, 1.0);
76 return n.xy;
77 }
78
79 #else
80 #define WB_Normal vec3
81 /
Well just do nothing... /
82 # define workbench_normal_encode(a) (a)
83 # define workbench_normal_decode(a) (a)
84 #endif /
WORKBENCH_ENCODE_NORMALS /
85
86 /
Encoding into the alpha of a RGBA8 UNORM texture. /
87 #define TARGET_BITCOUNT 8u
88 #define METALLIC_BITS 3u /
Metallic channel is less important. /
89 #define ROUGHNESS_BITS (TARGET_BITCOUNT - METALLIC_BITS)
90 #define TOTAL_BITS (METALLIC_BITS + ROUGHNESS_BITS)
91
92 /
Encode 2 float into 1 with the desired precision. /
93 float workbench_float_pair_encode(float v1, float v2)
94 {
95 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS);
96 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
97 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
98 int iv1 = int(v1 * float(v1_mask));
99 int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS;
100 return float(iv1 | iv2) * (1.0 / float(total_mask));
101 }
102
103 void workbench_float_pair_decode(float data, out float v1, out float v2)
104 {
105 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS);
106 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
107 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
108 uint idata = uint(data * float(total_mask));
109 v1 = float(idata & v1_mask) * (1.0 / float(v1_mask));
110 v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask));
111 }
112
113 float calculate_transparent_weight(float z, float alpha)
114 {
115 #if 0
116 /
Eq 10 : Good for surfaces with varying opacity (like particles) /
117 float a = min(1.0, alpha * 10.0) + 0.01;
118 float b = -gl_FragCoord.z * 0.95 + 1.0;
119 float w = a * a * a * 3e2 * b * b * b;
120 #else
121 /
Eq 7 put more emphasis on surfaces closer to the view. /
122 // float w = 10.0 / (1e-5 + pow(abs(z) / 5.0, 2.0) + pow(abs(z) / 200.0, 6.0)); /
Eq 7 /
123 // float w = 10.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0)); /
Eq 8 /
124 // float w = 10.0 / (1e-5 + pow(abs(z) / 200.0, 4.0)); /
Eq 9 /
125 /
Same as eq 7, but optimized. */
126 float a = abs(z) / 5.0;
127 float b = abs(z) / 200.0;
128 b = b;
129 float w = 10.0 / ((1e-5 + a * a) + b * (b * b)); /
Eq 7 /
130 #endif
131 return alpha * clamp(w, 1e-2, 3e2);
132 }
133
134 /
Special function only to be used with calculate_transparent_weight(). /
135 float linear_zdepth(float depth, vec4 viewvecs- [x], mat4 proj_mat)
136 {
137 if (proj_mat- [x]- [x] == 0.0) {
138 float d = 2.0 * depth - 1.0;
139 return -proj_mat- [x]- [x] / (d + proj_mat- [x][2]);
140 }
141 else {
142 /
Return depth from near plane. /
143 return depth * viewvecs- [x].z;
144 }
145 }
146
147 vec3 view_vector_from_screen_uv(vec2 uv, vec4 viewvecs- [x], mat4 proj_mat)
148 {
149 return (proj_mat- [x]- [x] == 0.0)
150 ? normalize(viewvecs- [x].xyz + vec3(uv, 0.0) * viewvecs- [x].xyz)
151 : vec3(0.0, 0.0, 1.0);
152 }
153
154 vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped)
155 {
156 /
Quick creation of an orthonormal basis /
157 float a = 1.0 / (1.0 + I.z);
158 float b = -I.x * I.y * a;
159 vec3 b1 = vec3(1.0 - I.x * I.x * a, b, -I.x);
160 vec3 b2 = vec3(b, 1.0 - I.y * I.y * a, -I.y);
161 vec2 matcap_uv = vec2(dot(b1, N), dot(b2, N));
162 if (flipped) {
163 matcap_uv.x = -matcap_uv.x;
164 }
165 return matcap_uv * 0.496 + 0.5;
166 }
167 uniform int object_id = 0;
168
169 uniform vec3 materialDiffuseColor;
170 uniform float materialMetallic;
171 uniform float materialRoughness;
172
173 uniform sampler2D image;
174 uniform float ImageTransparencyCutoff = 0.1;
175
176 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
177 in vec3 normal_viewport;
178 #endif
179
180 #ifdef V3D_SHADING_TEXTURE_COLOR
181 in vec2 uv_interp;
182 #endif
183
184 #ifdef HAIR_SHADER
185 flat in float hair_rand;
186 #endif
187
188 #ifdef MATDATA_PASS_ENABLED
189 layout(location=0) out vec4 materialData;
190 #endif
191 #ifdef OBJECT_ID_PASS_ENABLED
192 layout(location=1) out uint objectId;
193 #endif
194 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
195 layout(location=2) out WB_Normal normalViewport;
196 #endif
197
198 void main()
199 {
200 #ifdef MATDATA_PASS_ENABLED
201 float metallic, roughness;
202 vec4 color;
203
204 # ifdef V3D_SHADING_TEXTURE_COLOR
205 color = texture(image, uv_interp);
206 if (color.a < ImageTransparencyCutoff) {
207 discard;
208 }
209 # else
210 color.rgb = materialDiffuseColor;
211 # endif
212
213 # ifdef V3D_LIGHTING_MATCAP
214 /
Encode front facing in metallic channel. /
215 metallic = float(gl_FrontFacing);
216 roughness = 0.0;
217 # else
218 metallic = materialMetallic;
219 roughness = materialRoughness;
220 # endif
221
222 # ifdef HAIR_SHADER
223 /
Add some variation to the hairs to avoid uniform look. /
224 float hair_variation = hair_rand * 0.1;
225 color = clamp(color - hair_variation, 0.0, 1.0);
226 metallic = clamp(materialMetallic - hair_variation, 0.0, 1.0);
227 roughness = clamp(materialRoughness - hair_variation, 0.0, 1.0);
228 # endif
229
230 materialData.rgb = color.rgb;
231 materialData.a = workbench_float_pair_encode(roughness, metallic);
232 #endif /
MATDATA_PASS_ENABLED */
233
234 #ifdef OBJECT_ID_PASS_ENABLED
235 objectId = uint(object_id);
236 #endif
237
238 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
239 vec3 n = (gl_FrontFacing) ? normal_viewport : -normal_viewport;
240 n = normalize(n);
241 normalViewport = workbench_normal_encode(n);
242 #endif
243 }
Fragment shader failed to compile with the following errors:
WARNING: 4:88: warning(#283) Implicit cast from int to uint
ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int'
ERROR: error(#273) 1 compilation errors. No code generated

Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0066.vert
Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0066.frag
GPUShader: compile error:
shader string 1
1 #version 330
shader string 2
shader string 3
2 #define GPU_ATI
shader string 4
3 #define V3D_SHADING_OBJECT_OUTLINE
4 #define V3D_SHADING_SPECULAR_HIGHLIGHT
5 #define V3D_LIGHTING_STUDIO
6 #define OBJECT_ID_PASS_ENABLED
7 #define MATDATA_PASS_ENABLED
8 #define NORMAL_VIEWPORT_PASS_ENABLED
9 #define WORKBENCH_ENCODE_NORMALS
shader string 5
10 struct LightData {
11 vec4 direction;
12 vec4 specular_color;
13 vec4 diffuse_color_wrap; /* rgb: diffuse col a: wrapped lighting factor /
14 };
15
16 struct WorldData {
17 vec4 background_color_low;
18 vec4 background_color_high;
19 vec4 object_outline_color;
20 vec4 shadow_direction_vs;
21 LightData lights[4];
22 vec4 ambient_color;
23 int num_lights;
24 int matcap_orientation;
25 float background_alpha;
26 float curvature_ridge;
27 float curvature_valley;
28 int pad[3];
29 };
30 #define NO_OBJECT_ID uint(0)
31 #define EPSILON 0.00001
32 #define M_PI 3.14159265358979323846
33
34 #define CAVITY_BUFFER_RANGE 4.0
35
36 /
4x4 bayer matrix prepared for 8bit UNORM precision error. /
37 #define P(x) (((x + 0.5) * (1.0 / 16.0) - 0.5) * (1.0 / 255.0))
38 const vec4 dither_mat4x4- [x] = vec4[4](
39 vec4( P(0.0), P(8.0), P(2.0), P(10.0)),
40 vec4(P(12.0), P(4.0), P(14.0), P(6.0)),
41 vec4( P(3.0), P(11.0), P(1.0), P(9.0)),
42 vec4(P(15.0), P(7.0), P(13.0), P(5.0))
43 );
44
45 float bayer_dither_noise() {
46 ivec2 tx1 = ivec2(gl_FragCoord.xy) % 4;
47 ivec2 tx2 = ivec2(gl_FragCoord.xy) % 2;
48 return dither_mat4x4[tx1.x][tx1.y];
49 }
50
51 #ifdef WORKBENCH_ENCODE_NORMALS
52
53 #define WB_Normal vec2
54
55 /
From http://aras-p.info/texts/CompactNormalStorage.html
56 * Using Method #4: Spheremap Transform /
57 vec3 workbench_normal_decode(WB_Normal enc)
58 {
59 vec2 fenc = enc.xy * 4.0 - 2.0;
60 float f = dot(fenc, fenc);
61 float g = sqrt(1.0 - f / 4.0);
62 vec3 n;
63 n.xy = fenc
g;
64 n.z = 1 - f / 2;
65 return n;
66 }
67
68 /* From http://aras-p.info/texts/CompactNormalStorage.html
69 * Using Method #4: Spheremap Transform /
70 WB_Normal workbench_normal_encode(vec3 n)
71 {
72 float p = sqrt(n.z * 8.0 + 8.0);
73 n.xy = clamp(n.xy / p + 0.5, 0.0, 1.0);
74 return n.xy;
75 }
76
77 #else
78 #define WB_Normal vec3
79 /
Well just do nothing... /
80 # define workbench_normal_encode(a) (a)
81 # define workbench_normal_decode(a) (a)
82 #endif /
WORKBENCH_ENCODE_NORMALS /
83
84 /
Encoding into the alpha of a RGBA8 UNORM texture. /
85 #define TARGET_BITCOUNT 8u
86 #define METALLIC_BITS 3u /
Metallic channel is less important. /
87 #define ROUGHNESS_BITS (TARGET_BITCOUNT - METALLIC_BITS)
88 #define TOTAL_BITS (METALLIC_BITS + ROUGHNESS_BITS)
89
90 /
Encode 2 float into 1 with the desired precision. /
91 float workbench_float_pair_encode(float v1, float v2)
92 {
93 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS);
94 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
95 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
96 int iv1 = int(v1 * float(v1_mask));
97 int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS;
98 return float(iv1 | iv2) * (1.0 / float(total_mask));
99 }
100
101 void workbench_float_pair_decode(float data, out float v1, out float v2)
102 {
103 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS);
104 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
105 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
106 uint idata = uint(data * float(total_mask));
107 v1 = float(idata & v1_mask) * (1.0 / float(v1_mask));
108 v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask));
109 }
110
111 float calculate_transparent_weight(float z, float alpha)
112 {
113 #if 0
114 /
Eq 10 : Good for surfaces with varying opacity (like particles) /
115 float a = min(1.0, alpha * 10.0) + 0.01;
116 float b = -gl_FragCoord.z * 0.95 + 1.0;
117 float w = a * a * a * 3e2 * b * b * b;
118 #else
119 /
Eq 7 put more emphasis on surfaces closer to the view. /
120 // float w = 10.0 / (1e-5 + pow(abs(z) / 5.0, 2.0) + pow(abs(z) / 200.0, 6.0)); /
Eq 7 /
121 // float w = 10.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0)); /
Eq 8 /
122 // float w = 10.0 / (1e-5 + pow(abs(z) / 200.0, 4.0)); /
Eq 9 /
123 /
Same as eq 7, but optimized. */
124 float a = abs(z) / 5.0;
125 float b = abs(z) / 200.0;
126 b = b;
127 float w = 10.0 / ((1e-5 + a * a) + b * (b * b)); /
Eq 7 /
128 #endif
129 return alpha * clamp(w, 1e-2, 3e2);
130 }
131
132 /
Special function only to be used with calculate_transparent_weight(). /
133 float linear_zdepth(float depth, vec4 viewvecs- [x], mat4 proj_mat)
134 {
135 if (proj_mat- [x]- [x] == 0.0) {
136 float d = 2.0 * depth - 1.0;
137 return -proj_mat- [x]- [x] / (d + proj_mat- [x][2]);
138 }
139 else {
140 /
Return depth from near plane. /
141 return depth * viewvecs- [x].z;
142 }
143 }
144
145 vec3 view_vector_from_screen_uv(vec2 uv, vec4 viewvecs- [x], mat4 proj_mat)
146 {
147 return (proj_mat- [x]- [x] == 0.0)
148 ? normalize(viewvecs- [x].xyz + vec3(uv, 0.0) * viewvecs- [x].xyz)
149 : vec3(0.0, 0.0, 1.0);
150 }
151
152 vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped)
153 {
154 /
Quick creation of an orthonormal basis /
155 float a = 1.0 / (1.0 + I.z);
156 float b = -I.x * I.y * a;
157 vec3 b1 = vec3(1.0 - I.x * I.x * a, b, -I.x);
158 vec3 b2 = vec3(b, 1.0 - I.y * I.y * a, -I.y);
159 vec2 matcap_uv = vec2(dot(b1, N), dot(b2, N));
160 if (flipped) {
161 matcap_uv.x = -matcap_uv.x;
162 }
163 return matcap_uv * 0.496 + 0.5;
164 }
165 vec3 background_color(WorldData world_data, float y) {
166 return mix(world_data.background_color_low, world_data.background_color_high, y).xyz + bayer_dither_noise();
167 }
168
169 /
[Drobot2014a] Low Level Optimizations for GCN /
170 vec4 fast_rcp(vec4 v)
171 {
172 return intBitsToFloat(0x7eef370b - floatBitsToInt(v));
173 }
174
175 vec3 brdf_approx(vec3 spec_color, float roughness, float NV)
176 {
177 /
Very rough own approx. We don't need it to be correct, just fast.
178 * Just simulate fresnel effect with roughness attenuation. /
179 float fresnel = exp2(-8.35 * NV) * (1.0 - roughness);
180 return mix(spec_color, vec3(1.0), fresnel);
181 }
182
183 void prep_specular(
184 vec3 L, vec3 I, vec3 N, vec3 R,
185 out float NL, out float wrapped_NL, out float spec_angle)
186 {
187 wrapped_NL = dot(L, R);
188 vec3 half_dir = normalize(L + I);
189 spec_angle = clamp(dot(half_dir, N), 0.0, 1.0);
190 NL = clamp(dot(L, N), 0.0, 1.0);
191 }
192
193 /
Normalized Blinn shading /
194 vec4 blinn_specular(vec4 shininess, vec4 spec_angle, vec4 NL)
195 {
196 /
Pi is already divided in the lamp power.
197 * normalization_factor = (shininess + 8.0) / (8.0 * M_PI) /
198 vec4 normalization_factor = shininess * 0.125 + 1.0;
199 vec4 spec_light = pow(spec_angle, shininess) * NL * normalization_factor;
200
201 return spec_light;
202 }
203
204 /
NL need to be unclamped. w in [0..1] range. /
205 vec4 wrapped_lighting(vec4 NL, vec4 w)
206 {
207 vec4 w_1 = w + 1.0;
208 vec4 denom = fast_rcp(w_1 * w_1);
209 return clamp((NL + w) * denom, 0.0, 1.0);
210 }
211
212 vec3 get_world_lighting(
213 WorldData world_data,
214 vec3 diffuse_color, vec3 specular_color, float roughness,
215 vec3 N, vec3 I)
216 {
217 vec3 specular_light = world_data.ambient_color.rgb;
218 vec3 diffuse_light = world_data.ambient_color.rgb;
219 vec4 wrap = vec4(
220 world_data.lights- [x].diffuse_color_wrap.a,
221 world_data.lights- [x].diffuse_color_wrap.a,
222 world_data.lights- [x].diffuse_color_wrap.a,
223 world_data.lights- [x].diffuse_color_wrap.a
224 );
225
226 #ifdef V3D_SHADING_SPECULAR_HIGHLIGHT
227 /
Prepare Specular computation. Eval 4 lights at once. /
228 vec3 R = -reflect(I, N);
229 vec4 spec_angle, spec_NL, wrap_NL;
230 prep_specular(world_data.lights- [x].direction.xyz, I, N, R, spec_NL.x, wrap_NL.x, spec_angle.x);
231 prep_specular(world_data.lights- [x].direction.xyz, I, N, R, spec_NL.y, wrap_NL.y, spec_angle.y);
232 prep_specular(world_data.lights- [x].direction.xyz, I, N, R, spec_NL.z, wrap_NL.z, spec_angle.z);
233 prep_specular(world_data.lights- [x].direction.xyz, I, N, R, spec_NL.w, wrap_NL.w, spec_angle.w);
234
235 vec4 gloss = vec4(1.0 - roughness);
236 /
Reduce gloss for smooth light. (simulate bigger light) */
237 gloss = 1.0 - wrap;
238 vec4 shininess = exp2(10.0 * gloss + 1.0);
239
240 vec4 spec_light = blinn_specular(shininess, spec_angle, spec_NL);
241
242 /
Simulate Env. light. /
243 vec4 w = mix(wrap, vec4(1.0), roughness);
244 vec4 spec_env = wrapped_lighting(wrap_NL, w);
245
246 spec_light = mix(spec_light, spec_env, wrap * wrap);
247
248 /
Multiply result by lights specular colors. */
249 specular_light += spec_light.x * world_data.lights- [x].specular_color.rgb;
250 specular_light += spec_light.y * world_data.lights- [x].specular_color.rgb;
251 specular_light += spec_light.z * world_data.lights- [x].specular_color.rgb;
252 specular_light += spec_light.w * world_data.lights- [x].specular_color.rgb;
253
254 float NV = clamp(dot(N, I), 0.0, 1.0);
255 specular_color = brdf_approx(specular_color, roughness, NV);
256 #endif
257 specular_light = specular_color;
258
259 /
Prepare diffuse computation. Eval 4 lights at once. /
260 vec4 diff_NL;
261 diff_NL.x = dot(world_data.lights- [x].direction.xyz, N);
262 diff_NL.y = dot(world_data.lights- [x].direction.xyz, N);
263 diff_NL.z = dot(world_data.lights- [x].direction.xyz, N);
264 diff_NL.w = dot(world_data.lights- [x].direction.xyz, N);
265
266 vec4 diff_light = wrapped_lighting(diff_NL, wrap);
267
268 /
Multiply result by lights diffuse colors. /
269 diffuse_light += diff_light.x * world_data.lights- [x].diffuse_color_wrap.rgb;
270 diffuse_light += diff_light.y * world_data.lights- [x].diffuse_color_wrap.rgb;
271 diffuse_light += diff_light.z * world_data.lights- [x].diffuse_color_wrap.rgb;
272 diffuse_light += diff_light.w * world_data.lights- [x].diffuse_color_wrap.rgb;
273
274 /
Energy conservation with colored specular look strange.
275 * Limit this strangeness by using mono-chromatic specular intensity. */
276 float spec_energy = dot(specular_color, vec3(0.33333));
277
278 diffuse_light = diffuse_color * (1.0 - spec_energy);
279
280 return diffuse_light + specular_light;
281 }
282 #define OBJECT_OUTLINE_OFFSET 1
283
284 float calculate_object_outline(usampler2D objectId, ivec2 texel, uint object_id)
285 {
286 uvec4 oid_offset = uvec4(
287 texelFetchOffset(objectId, texel, 0, ivec2(0, OBJECT_OUTLINE_OFFSET)).r,
288 texelFetchOffset(objectId, texel, 0, ivec2(0, -OBJECT_OUTLINE_OFFSET)).r,
289 texelFetchOffset(objectId, texel, 0, ivec2(-OBJECT_OUTLINE_OFFSET, 0)).r,
290 texelFetchOffset(objectId, texel, 0, ivec2( OBJECT_OUTLINE_OFFSET, 0)).r);
291
292 return dot(vec4(equal(uvec4(object_id), oid_offset)), vec4(0.25));
293 }
294 out vec4 fragColor;
295
296 uniform mat4 ProjectionMatrix;
297 uniform mat4 ViewMatrixInverse;
298
299 uniform usampler2D objectId;
300 uniform sampler2D materialBuffer;
301 uniform sampler2D normalBuffer;
302 /
normalBuffer contains viewport normals /
303 uniform sampler2D cavityBuffer;
304 uniform sampler2D matcapImage;
305
306 uniform vec2 invertedViewportSize;
307 uniform vec4 viewvecs[3];
308 uniform float shadowMultiplier;
309 uniform float lightMultiplier;
310 uniform float shadowShift = 0.1;
311 uniform float shadowFocus = 1.0;
312
313 uniform vec3 materialSingleColor;
314
315 layout(std140) uniform world_block {
316 WorldData world_data;
317 };
318
319 void main()
320 {
321 ivec2 texel = ivec2(gl_FragCoord.xy);
322 vec2 uv_viewport = gl_FragCoord.xy * invertedViewportSize;
323
324 float roughness, metallic;
325 vec3 base_color;
326
327 #ifndef MATDATA_PASS_ENABLED
328 base_color = materialSingleColor;
329 metallic = 0.0;
330 roughness = 0.5;
331 #else
332 vec4 material_data = texelFetch(materialBuffer, texel, 0);
333 base_color = material_data.rgb;
334 workbench_float_pair_decode(material_data.a, roughness, metallic);
335 #endif
336
337 /
Do we need normals /
338 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
339 vec3 normal_viewport = workbench_normal_decode(texelFetch(normalBuffer, texel, 0).rg);
340 #endif
341
342 vec3 I_vs = view_vector_from_screen_uv(uv_viewport, viewvecs, ProjectionMatrix);
343
344 /
-------- SHADING --------- /
345 #ifdef V3D_LIGHTING_FLAT
346 vec3 shaded_color = base_color;
347
348 #elif defined(V3D_LIGHTING_MATCAP)
349 /
When using matcaps, the metallic is the backface sign. /
350 normal_viewport = (metallic > 0.0) ? normal_viewport : -normal_viewport;
351 bool flipped = world_data.matcap_orientation != 0;
352 vec2 matcap_uv = matcap_uv_compute(I_vs, normal_viewport, flipped);
353 vec3 matcap = textureLod(matcapImage, matcap_uv, 0.0).rgb;
354 vec3 shaded_color = matcap * base_color;
355
356 #elif defined(V3D_LIGHTING_STUDIO)
357
358 # ifdef V3D_SHADING_SPECULAR_HIGHLIGHT
359 vec3 specular_color = mix(vec3(0.05), base_color, metallic);
360 vec3 diffuse_color = mix(base_color, vec3(0.0), metallic);
361 # else
362 roughness = 0.0;
363 vec3 specular_color = vec3(0.0);
364 vec3 diffuse_color = base_color;
365 # endif
366
367 vec3 shaded_color = get_world_lighting(world_data,
368 diffuse_color, specular_color, roughness,
369 normal_viewport, I_vs);
370 #endif
371
372 /
-------- POST EFFECTS --------- /
373 #ifdef WB_CAVITY
374 /
Using UNORM texture so decompress the range */
375 shaded_color *= texelFetch(cavityBuffer, texel, 0).r * CAVITY_BUFFER_RANGE;
376 #endif
377
378 #ifdef V3D_SHADING_SHADOW
379 float light_factor = -dot(normal_viewport, world_data.shadow_direction_vs.xyz);
380 float shadow_mix = smoothstep(shadowFocus, shadowShift, light_factor);
381 shaded_color *= mix(lightMultiplier, shadowMultiplier, shadow_mix);
382 #endif
383
384 #ifdef V3D_SHADING_OBJECT_OUTLINE
385 uint object_id = texelFetch(objectId, texel, 0).r;
386 float object_outline = calculate_object_outline(objectId, texel, object_id);
387 shaded_color = mix(world_data.object_outline_color.rgb, shaded_color, object_outline);
388 #endif
389
390 fragColor = vec4(shaded_color, 1.0);
391 }
Fragment shader failed to compile with the following errors:
WARNING: 4:88: warning(#283) Implicit cast from int to uint
ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int'
ERROR: error(#273) 1 compilation errors. No code generated

**System Information** Operating system:windows 10 pro 32 bit Graphics card:ati radeon 3000 **Blender Version** Broken: (example: 2.79b release) (example: 2.80, edbf15d3c044, blender2.8, 2018-11-28, as found on the splash screen) Worked: (optional)blender-2.80.0-git.aca13040dac-windows32 **Short description of error** does not start, no message give even if starting it with console and as admin...? **Exact steps for others to reproduce the error** Based on the default startup or an attached .blend file (as simple as possible). download and run (on my system) Basically Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0066.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0066.frag GPUShader: compile error: **shader string 1** 1 #version 330 **shader string 2** **shader string 3** 2 #define GPU_ATI **shader string 4** bla bla bla 388 #endif 389 390 fragColor = vec4(shaded_color, 1.0); 391 } Fragment shader failed to compile with the following errors: WARNING: 4:88: warning(#283) Implicit cast from int to uint ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int' ERROR: error(#273) 1 compilation errors. No code generated whole transcript follows ----------------- F:\DesktopEverywhere\blender-2.80.0-git.aca13040dac-windows32>blender --debug-all Switching to fully guarded memory allocator. read file ``` Version 280 sub 24 date unknown hash unknown ``` DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=SCScene flags=LEGACY_0 AL lib: (EE) UpdateDeviceParams: Failed to set 48000hz, got 44100hz instead ED_screen_refresh: set screen DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=SCScene flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=OBCube flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=MECube flags=LEGACY_0 DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=MAMaterial flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=NTShader Nodetree flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=NTShader Nodetree flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=MECube flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=OBLight flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=LALight flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=OBCamera flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=CACamera flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=GRMaster Collection flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=GRCollection flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=WOWorld flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=SCScene flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=OBCube flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=MECube flags=LEGACY_0 DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=MAMaterial flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=NTShader Nodetree flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=NTShader Nodetree flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=MECube flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=OBLight flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=LALight flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=OBCamera flags=TRANSFORM, GEOMETRY, COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=CACamera flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=GRMaster Collection flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=GRCollection flags=COPY_ON_WRITE DEG::`anonymous-namespace'::deg_graph_id_tag_update: id=WOWorld flags=COPY_ON_WRITE Depsgraph built in 0.178116 seconds. [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: PLACEHOLDER(Eval Init) [SCScene :: View Layer]: Operation is entry point for update: GEOMETRY_SELECT_UPDATE() [SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_OBJECT_UBEREVAL() [SCScene :: View Layer]: Operation is entry point for update: PLACEHOLDER(Eval Done) [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_LOCAL() [SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_LOCAL() [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: PLACEHOLDER(Scene Eval) [SCScene :: View Layer]: Operation is entry point for update: PARAMETERS_EVAL() [SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_OBJECT_UBEREVAL() [SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_FINAL() [SCScene :: View Layer]: Operation is entry point for update: VIEW_LAYER_EVAL() [SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_FINAL() [SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_LOCAL() [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_FINAL() [SCScene :: View Layer]: Operation is entry point for update: TRANSFORM_OBJECT_UBEREVAL() [SCScene :: View Layer]: Operation is entry point for update: GEOMETRY_UBEREVAL() [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: PLACEHOLDER(Geometry Eval) [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Operation is entry point for update: COPY_ON_WRITE() [SCScene :: View Layer]: Accumulated recalc bits for SCScene: 128 [SCScene :: View Layer]: Accumulated recalc bits for OBCube: 387 [SCScene :: View Layer]: Accumulated recalc bits for MAMaterial: 384 [SCScene :: View Layer]: Accumulated recalc bits for NTShader Nodetree: 128 [SCScene :: View Layer]: Accumulated recalc bits for MECube: 4294967171 [SCScene :: View Layer]: Accumulated recalc bits for OBLight: 131 [SCScene :: View Layer]: Accumulated recalc bits for LALight: 128 [SCScene :: View Layer]: Accumulated recalc bits for OBCamera: 131 [SCScene :: View Layer]: Accumulated recalc bits for CACamera: 128 [SCScene :: View Layer]: Accumulated recalc bits for GRMaster Collection: 128 [SCScene :: View Layer]: Accumulated recalc bits for GRCollection: 128 [SCScene :: View Layer]: Accumulated recalc bits for WOWorld: 128 [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on WOWorld (08F7C840) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on GRCollection (08F02190) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on GRMaster Collection (08F00930) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on CACamera (08F5D2E0) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on LALight (08F36458) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on MECube (090D7210) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on OBCamera (090D7C50) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on OBLight (090D7790) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on OBCube (08F5CC90) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on NTShader Nodetree (08F5D150) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on SCScene (08FD14A8) [SCScene :: View Layer]: DEG::deg_evaluate_copy_on_write on MAMaterial (08FEC5F0) [SCScene :: View Layer]: BKE_layer_eval_view_layer on View Layer (0C760020) [SCScene :: View Layer]: BKE_object_eval_local_transform on OBLight (090D7790) [SCScene :: View Layer]: BKE_object_eval_local_transform on OBCamera (090D7C50) [SCScene :: View Layer]: BKE_object_eval_flush_base_flags on OBCube (08F5CC90) [SCScene :: View Layer]: BKE_object_eval_transform_final on OBLight (090D7790) [SCScene :: View Layer]: BKE_object_eval_transform_final on OBCamera (090D7C50) [SCScene :: View Layer]: BKE_object_eval_flush_base_flags on OBCamera (090D7C50) [SCScene :: View Layer]: BKE_object_eval_flush_base_flags on OBLight (090D7790) [SCScene :: View Layer]: BKE_object_data_select_update on MECube (090D7210) [SCScene :: View Layer]: BKE_mesh_eval_geometry on MECube (090D7210) [SCScene :: View Layer]: BKE_material_eval on MAMaterial (08FEC5F0) [SCScene :: View Layer]: BKE_object_eval_local_transform on OBCube (08F5CC90) [SCScene :: View Layer]: BKE_object_eval_uber_data on OBCube (08F5CC90) [SCScene :: View Layer]: BKE_object_eval_transform_final on OBCube (08F5CC90) [SCScene :: View Layer]: BKE_object_handle_data_update on OBCube (08F5CC90) [SCScene :: View Layer]: BKE_object_eval_update_shading on OBCube (08F5CC90) Depsgraph updated in 0.083674 seconds. found bundled python: F:\DesktopEverywhere\blender-2.80.0-git.aca13040dac-windows32\2.80\python time bl_operators 0.1929 time bl_ui 0.6596 time keyingsets_builtins 0.0141 time nodeitems_builtins 0.0176 bl_app_template_utils.reset('') ``` addon_utils.enable io_scene_fbx addon_utils.enable io_anim_bvh addon_utils.enable io_mesh_ply addon_utils.enable io_scene_obj addon_utils.enable io_mesh_stl addon_utils.enable io_mesh_uv_layout addon_utils.enable io_curve_svg ``` I1214 12:17:25.350327 2656 blender_python.cpp:189] Debug flags initialized to: CPU flags: ``` AVX2 : True AVX : True SSE4.1 : True SSE3 : True SSE2 : True BVH layout : BVH8 Split : False ``` CUDA flags: Adaptive Compile: False OpenCL flags: ``` Device type : ALL Kernel type : DEFAULT Debug : False Single program : True Memory limit : 0 addon_utils.enable cycles addon_utils.enable io_scene_gltf2 ``` Python Script Load Time 1.2767 Warning, unregistered class: Import3DS(Operator) Warning, unregistered class: Export3DS(Operator) Warning, unregistered class: ImportX3D(Operator) Warning, unregistered class: ExportX3D(Operator) Warning, unregistered class: PresetMenu(Panel) Warning, unregistered class: PARTICLE_PT_render_billboards_alignment(Panel) Warning, unregistered class: VIEW3D_PT_tools_grease_pencil_edit(Panel) Warning, unregistered class: CYCLES_RENDER_PT_sampling_total(Panel) Warning, unregistered class: MASK_MT_add(Menu) loading preset: F:\DesktopEverywhere\blender-2.80.0-git.aca13040dac-windows32\2.80\scripts\presets\keyconfig\blender.py FRS_set_context: context 0x05542C10 scene 0x08FF0AA0 UI_menutype_draw: opening menu "WM_MT_splash" ghost_event_proc: window 1 state = normal ED_screen_refresh: set screen Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0001.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0001.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0001.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0002.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0002.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0003.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0003.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0004.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0004.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0005.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0005.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0006.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0006.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0007.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0007.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0008.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0008.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0009.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0009.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0010.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0010.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0010.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0011.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0011.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0011.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0012.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0012.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0012.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0013.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0013.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0013.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0014.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0014.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0014.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0015.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0015.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0015.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0016.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0016.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0017.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0017.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0018.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0018.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0019.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0019.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0020.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0020.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0020.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0021.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0021.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0022.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0022.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0022.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0023.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0023.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0024.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0024.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0024.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0025.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0025.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0026.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0026.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0027.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0027.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0028.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0028.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0029.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0029.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0030.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0030.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0031.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0031.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0032.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0032.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0033.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0033.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0034.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0034.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0035.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0035.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0036.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0036.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0037.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0037.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0038.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0038.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0039.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0039.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0039.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0040.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0040.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0040.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0041.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0041.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0041.geom Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0042.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0042.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0043.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0043.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0044.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0044.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0045.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0045.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0046.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0046.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0047.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0047.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0048.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0048.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0049.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0049.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0050.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0050.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0051.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0051.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0052.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0052.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0053.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0053.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0054.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0054.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0055.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0055.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0056.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0056.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0057.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0057.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0058.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0058.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0059.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0059.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0060.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0060.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0061.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0061.frag Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0062.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0062.frag GPUShader: compile error: **shader string 1** 1 #version 330 **shader string 2** **shader string 3** 2 #define GPU_ATI **shader string 4** 3 #define V3D_SHADING_OBJECT_OUTLINE 4 #define V3D_SHADING_SPECULAR_HIGHLIGHT 5 #define V3D_LIGHTING_STUDIO 6 #define OBJECT_ID_PASS_ENABLED 7 #define MATDATA_PASS_ENABLED 8 #define NORMAL_VIEWPORT_PASS_ENABLED 9 #define WORKBENCH_ENCODE_NORMALS **shader string 5** 10 struct LightData { 11 vec4 direction; 12 vec4 specular_color; 13 vec4 diffuse_color_wrap; /* rgb: diffuse col a: wrapped lighting factor */ 14 }; 15 16 struct WorldData { 17 vec4 background_color_low; 18 vec4 background_color_high; 19 vec4 object_outline_color; 20 vec4 shadow_direction_vs; 21 LightData lights[4]; 22 vec4 ambient_color; 23 int num_lights; 24 int matcap_orientation; 25 float background_alpha; 26 float curvature_ridge; 27 float curvature_valley; 28 int pad[3]; 29 }; 30 #define NO_OBJECT_ID uint(0) 31 #define EPSILON 0.00001 32 #define M_PI 3.14159265358979323846 33 34 #define CAVITY_BUFFER_RANGE 4.0 35 36 /* 4x4 bayer matrix prepared for 8bit UNORM precision error. */ 37 #define P(x) (((x + 0.5) * (1.0 / 16.0) - 0.5) * (1.0 / 255.0)) 38 const vec4 dither_mat4x4- [x] = vec4[4]( 39 vec4( P(0.0), P(8.0), P(2.0), P(10.0)), 40 vec4(P(12.0), P(4.0), P(14.0), P(6.0)), 41 vec4( P(3.0), P(11.0), P(1.0), P(9.0)), 42 vec4(P(15.0), P(7.0), P(13.0), P(5.0)) 43 ); 44 45 float bayer_dither_noise() { 46 ivec2 tx1 = ivec2(gl_FragCoord.xy) % 4; 47 ivec2 tx2 = ivec2(gl_FragCoord.xy) % 2; 48 return dither_mat4x4[tx1.x][tx1.y]; 49 } 50 51 #ifdef WORKBENCH_ENCODE_NORMALS 52 53 #define WB_Normal vec2 54 55 /* From http://aras-p.info/texts/CompactNormalStorage.html 56 * Using Method #4: Spheremap Transform */ 57 vec3 workbench_normal_decode(WB_Normal enc) 58 { 59 vec2 fenc = enc.xy * 4.0 - 2.0; 60 float f = dot(fenc, fenc); 61 float g = sqrt(1.0 - f / 4.0); 62 vec3 n; 63 n.xy = fenc*g; 64 n.z = 1 - f / 2; 65 return n; 66 } 67 68 /* From http://aras-p.info/texts/CompactNormalStorage.html 69 * Using Method #4: Spheremap Transform */ 70 WB_Normal workbench_normal_encode(vec3 n) 71 { 72 float p = sqrt(n.z * 8.0 + 8.0); 73 n.xy = clamp(n.xy / p + 0.5, 0.0, 1.0); 74 return n.xy; 75 } 76 77 #else 78 #define WB_Normal vec3 79 /* Well just do nothing... */ 80 # define workbench_normal_encode(a) (a) 81 # define workbench_normal_decode(a) (a) 82 #endif /* WORKBENCH_ENCODE_NORMALS */ 83 84 /* Encoding into the alpha of a RGBA8 UNORM texture. */ 85 #define TARGET_BITCOUNT 8u 86 #define METALLIC_BITS 3u /* Metallic channel is less important. */ 87 #define ROUGHNESS_BITS (TARGET_BITCOUNT - METALLIC_BITS) 88 #define TOTAL_BITS (METALLIC_BITS + ROUGHNESS_BITS) 89 90 /* Encode 2 float into 1 with the desired precision. */ 91 float workbench_float_pair_encode(float v1, float v2) 92 { 93 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS); 94 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); 95 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); 96 int iv1 = int(v1 * float(v1_mask)); 97 int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS; 98 return float(iv1 | iv2) * (1.0 / float(total_mask)); 99 } 100 101 void workbench_float_pair_decode(float data, out float v1, out float v2) 102 { 103 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS); 104 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); 105 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); 106 uint idata = uint(data * float(total_mask)); 107 v1 = float(idata & v1_mask) * (1.0 / float(v1_mask)); 108 v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask)); 109 } 110 111 float calculate_transparent_weight(float z, float alpha) 112 { 113 #if 0 114 /* Eq 10 : Good for surfaces with varying opacity (like particles) */ 115 float a = min(1.0, alpha * 10.0) + 0.01; 116 float b = -gl_FragCoord.z * 0.95 + 1.0; 117 float w = a * a * a * 3e2 * b * b * b; 118 #else 119 /* Eq 7 put more emphasis on surfaces closer to the view. */ 120 // float w = 10.0 / (1e-5 + pow(abs(z) / 5.0, 2.0) + pow(abs(z) / 200.0, 6.0)); /* Eq 7 */ 121 // float w = 10.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0)); /* Eq 8 */ 122 // float w = 10.0 / (1e-5 + pow(abs(z) / 200.0, 4.0)); /* Eq 9 */ 123 /* Same as eq 7, but optimized. */ 124 float a = abs(z) / 5.0; 125 float b = abs(z) / 200.0; 126 b *= b; 127 float w = 10.0 / ((1e-5 + a * a) + b * (b * b)); /* Eq 7 */ 128 #endif 129 return alpha * clamp(w, 1e-2, 3e2); 130 } 131 132 /* Special function only to be used with calculate_transparent_weight(). */ 133 float linear_zdepth(float depth, vec4 viewvecs- [x], mat4 proj_mat) 134 { 135 if (proj_mat- [x]- [x] == 0.0) { 136 float d = 2.0 * depth - 1.0; 137 return -proj_mat- [x]- [x] / (d + proj_mat- [x][2]); 138 } 139 else { 140 /* Return depth from near plane. */ 141 return depth * viewvecs- [x].z; 142 } 143 } 144 145 vec3 view_vector_from_screen_uv(vec2 uv, vec4 viewvecs- [x], mat4 proj_mat) 146 { 147 return (proj_mat- [x]- [x] == 0.0) 148 ? normalize(viewvecs- [x].xyz + vec3(uv, 0.0) * viewvecs- [x].xyz) 149 : vec3(0.0, 0.0, 1.0); 150 } 151 152 vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped) 153 { 154 /* Quick creation of an orthonormal basis */ 155 float a = 1.0 / (1.0 + I.z); 156 float b = -I.x * I.y * a; 157 vec3 b1 = vec3(1.0 - I.x * I.x * a, b, -I.x); 158 vec3 b2 = vec3(b, 1.0 - I.y * I.y * a, -I.y); 159 vec2 matcap_uv = vec2(dot(b1, N), dot(b2, N)); 160 if (flipped) { 161 matcap_uv.x = -matcap_uv.x; 162 } 163 return matcap_uv * 0.496 + 0.5; 164 } 165 uniform int object_id = 0; 166 167 uniform vec3 materialDiffuseColor; 168 uniform float materialMetallic; 169 uniform float materialRoughness; 170 171 uniform sampler2D image; 172 uniform float ImageTransparencyCutoff = 0.1; 173 174 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 175 in vec3 normal_viewport; 176 #endif 177 178 #ifdef V3D_SHADING_TEXTURE_COLOR 179 in vec2 uv_interp; 180 #endif 181 182 #ifdef HAIR_SHADER 183 flat in float hair_rand; 184 #endif 185 186 #ifdef MATDATA_PASS_ENABLED 187 layout(location=0) out vec4 materialData; 188 #endif 189 #ifdef OBJECT_ID_PASS_ENABLED 190 layout(location=1) out uint objectId; 191 #endif 192 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 193 layout(location=2) out WB_Normal normalViewport; 194 #endif 195 196 void main() 197 { 198 #ifdef MATDATA_PASS_ENABLED 199 float metallic, roughness; 200 vec4 color; 201 202 # ifdef V3D_SHADING_TEXTURE_COLOR 203 color = texture(image, uv_interp); 204 if (color.a < ImageTransparencyCutoff) { 205 discard; 206 } 207 # else 208 color.rgb = materialDiffuseColor; 209 # endif 210 211 # ifdef V3D_LIGHTING_MATCAP 212 /* Encode front facing in metallic channel. */ 213 metallic = float(gl_FrontFacing); 214 roughness = 0.0; 215 # else 216 metallic = materialMetallic; 217 roughness = materialRoughness; 218 # endif 219 220 # ifdef HAIR_SHADER 221 /* Add some variation to the hairs to avoid uniform look. */ 222 float hair_variation = hair_rand * 0.1; 223 color = clamp(color - hair_variation, 0.0, 1.0); 224 metallic = clamp(materialMetallic - hair_variation, 0.0, 1.0); 225 roughness = clamp(materialRoughness - hair_variation, 0.0, 1.0); 226 # endif 227 228 materialData.rgb = color.rgb; 229 materialData.a = workbench_float_pair_encode(roughness, metallic); 230 #endif /* MATDATA_PASS_ENABLED */ 231 232 #ifdef OBJECT_ID_PASS_ENABLED 233 objectId = uint(object_id); 234 #endif 235 236 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 237 vec3 n = (gl_FrontFacing) ? normal_viewport : -normal_viewport; 238 n = normalize(n); 239 normalViewport = workbench_normal_encode(n); 240 #endif 241 } Fragment shader failed to compile with the following errors: WARNING: 4:88: warning(#283) Implicit cast from int to uint ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int' ERROR: error(#273) 1 compilation errors. No code generated Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0063.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0063.frag GPUShader: compile error: **shader string 1** 1 #version 330 **shader string 2** **shader string 3** 2 #define GPU_ATI **shader string 4** 3 #define V3D_SHADING_OBJECT_OUTLINE 4 #define V3D_SHADING_SPECULAR_HIGHLIGHT 5 #define V3D_LIGHTING_STUDIO 6 #define OBJECT_ID_PASS_ENABLED 7 #define MATDATA_PASS_ENABLED 8 #define NORMAL_VIEWPORT_PASS_ENABLED 9 #define WORKBENCH_ENCODE_NORMALS 10 #define HAIR_SHADER **shader string 5** 11 struct LightData { 12 vec4 direction; 13 vec4 specular_color; 14 vec4 diffuse_color_wrap; /* rgb: diffuse col a: wrapped lighting factor */ 15 }; 16 17 struct WorldData { 18 vec4 background_color_low; 19 vec4 background_color_high; 20 vec4 object_outline_color; 21 vec4 shadow_direction_vs; 22 LightData lights[4]; 23 vec4 ambient_color; 24 int num_lights; 25 int matcap_orientation; 26 float background_alpha; 27 float curvature_ridge; 28 float curvature_valley; 29 int pad[3]; 30 }; 31 #define NO_OBJECT_ID uint(0) 32 #define EPSILON 0.00001 33 #define M_PI 3.14159265358979323846 34 35 #define CAVITY_BUFFER_RANGE 4.0 36 37 /* 4x4 bayer matrix prepared for 8bit UNORM precision error. */ 38 #define P(x) (((x + 0.5) * (1.0 / 16.0) - 0.5) * (1.0 / 255.0)) 39 const vec4 dither_mat4x4- [x] = vec4[4]( 40 vec4( P(0.0), P(8.0), P(2.0), P(10.0)), 41 vec4(P(12.0), P(4.0), P(14.0), P(6.0)), 42 vec4( P(3.0), P(11.0), P(1.0), P(9.0)), 43 vec4(P(15.0), P(7.0), P(13.0), P(5.0)) 44 ); 45 46 float bayer_dither_noise() { 47 ivec2 tx1 = ivec2(gl_FragCoord.xy) % 4; 48 ivec2 tx2 = ivec2(gl_FragCoord.xy) % 2; 49 return dither_mat4x4[tx1.x][tx1.y]; 50 } 51 52 #ifdef WORKBENCH_ENCODE_NORMALS 53 54 #define WB_Normal vec2 55 56 /* From http://aras-p.info/texts/CompactNormalStorage.html 57 * Using Method #4: Spheremap Transform */ 58 vec3 workbench_normal_decode(WB_Normal enc) 59 { 60 vec2 fenc = enc.xy * 4.0 - 2.0; 61 float f = dot(fenc, fenc); 62 float g = sqrt(1.0 - f / 4.0); 63 vec3 n; 64 n.xy = fenc*g; 65 n.z = 1 - f / 2; 66 return n; 67 } 68 69 /* From http://aras-p.info/texts/CompactNormalStorage.html 70 * Using Method #4: Spheremap Transform */ 71 WB_Normal workbench_normal_encode(vec3 n) 72 { 73 float p = sqrt(n.z * 8.0 + 8.0); 74 n.xy = clamp(n.xy / p + 0.5, 0.0, 1.0); 75 return n.xy; 76 } 77 78 #else 79 #define WB_Normal vec3 80 /* Well just do nothing... */ 81 # define workbench_normal_encode(a) (a) 82 # define workbench_normal_decode(a) (a) 83 #endif /* WORKBENCH_ENCODE_NORMALS */ 84 85 /* Encoding into the alpha of a RGBA8 UNORM texture. */ 86 #define TARGET_BITCOUNT 8u 87 #define METALLIC_BITS 3u /* Metallic channel is less important. */ 88 #define ROUGHNESS_BITS (TARGET_BITCOUNT - METALLIC_BITS) 89 #define TOTAL_BITS (METALLIC_BITS + ROUGHNESS_BITS) 90 91 /* Encode 2 float into 1 with the desired precision. */ 92 float workbench_float_pair_encode(float v1, float v2) 93 { 94 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS); 95 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); 96 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); 97 int iv1 = int(v1 * float(v1_mask)); 98 int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS; 99 return float(iv1 | iv2) * (1.0 / float(total_mask)); 100 } 101 102 void workbench_float_pair_decode(float data, out float v1, out float v2) 103 { 104 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS); 105 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); 106 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); 107 uint idata = uint(data * float(total_mask)); 108 v1 = float(idata & v1_mask) * (1.0 / float(v1_mask)); 109 v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask)); 110 } 111 112 float calculate_transparent_weight(float z, float alpha) 113 { 114 #if 0 115 /* Eq 10 : Good for surfaces with varying opacity (like particles) */ 116 float a = min(1.0, alpha * 10.0) + 0.01; 117 float b = -gl_FragCoord.z * 0.95 + 1.0; 118 float w = a * a * a * 3e2 * b * b * b; 119 #else 120 /* Eq 7 put more emphasis on surfaces closer to the view. */ 121 // float w = 10.0 / (1e-5 + pow(abs(z) / 5.0, 2.0) + pow(abs(z) / 200.0, 6.0)); /* Eq 7 */ 122 // float w = 10.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0)); /* Eq 8 */ 123 // float w = 10.0 / (1e-5 + pow(abs(z) / 200.0, 4.0)); /* Eq 9 */ 124 /* Same as eq 7, but optimized. */ 125 float a = abs(z) / 5.0; 126 float b = abs(z) / 200.0; 127 b *= b; 128 float w = 10.0 / ((1e-5 + a * a) + b * (b * b)); /* Eq 7 */ 129 #endif 130 return alpha * clamp(w, 1e-2, 3e2); 131 } 132 133 /* Special function only to be used with calculate_transparent_weight(). */ 134 float linear_zdepth(float depth, vec4 viewvecs- [x], mat4 proj_mat) 135 { 136 if (proj_mat- [x]- [x] == 0.0) { 137 float d = 2.0 * depth - 1.0; 138 return -proj_mat- [x]- [x] / (d + proj_mat- [x][2]); 139 } 140 else { 141 /* Return depth from near plane. */ 142 return depth * viewvecs- [x].z; 143 } 144 } 145 146 vec3 view_vector_from_screen_uv(vec2 uv, vec4 viewvecs- [x], mat4 proj_mat) 147 { 148 return (proj_mat- [x]- [x] == 0.0) 149 ? normalize(viewvecs- [x].xyz + vec3(uv, 0.0) * viewvecs- [x].xyz) 150 : vec3(0.0, 0.0, 1.0); 151 } 152 153 vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped) 154 { 155 /* Quick creation of an orthonormal basis */ 156 float a = 1.0 / (1.0 + I.z); 157 float b = -I.x * I.y * a; 158 vec3 b1 = vec3(1.0 - I.x * I.x * a, b, -I.x); 159 vec3 b2 = vec3(b, 1.0 - I.y * I.y * a, -I.y); 160 vec2 matcap_uv = vec2(dot(b1, N), dot(b2, N)); 161 if (flipped) { 162 matcap_uv.x = -matcap_uv.x; 163 } 164 return matcap_uv * 0.496 + 0.5; 165 } 166 uniform int object_id = 0; 167 168 uniform vec3 materialDiffuseColor; 169 uniform float materialMetallic; 170 uniform float materialRoughness; 171 172 uniform sampler2D image; 173 uniform float ImageTransparencyCutoff = 0.1; 174 175 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 176 in vec3 normal_viewport; 177 #endif 178 179 #ifdef V3D_SHADING_TEXTURE_COLOR 180 in vec2 uv_interp; 181 #endif 182 183 #ifdef HAIR_SHADER 184 flat in float hair_rand; 185 #endif 186 187 #ifdef MATDATA_PASS_ENABLED 188 layout(location=0) out vec4 materialData; 189 #endif 190 #ifdef OBJECT_ID_PASS_ENABLED 191 layout(location=1) out uint objectId; 192 #endif 193 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 194 layout(location=2) out WB_Normal normalViewport; 195 #endif 196 197 void main() 198 { 199 #ifdef MATDATA_PASS_ENABLED 200 float metallic, roughness; 201 vec4 color; 202 203 # ifdef V3D_SHADING_TEXTURE_COLOR 204 color = texture(image, uv_interp); 205 if (color.a < ImageTransparencyCutoff) { 206 discard; 207 } 208 # else 209 color.rgb = materialDiffuseColor; 210 # endif 211 212 # ifdef V3D_LIGHTING_MATCAP 213 /* Encode front facing in metallic channel. */ 214 metallic = float(gl_FrontFacing); 215 roughness = 0.0; 216 # else 217 metallic = materialMetallic; 218 roughness = materialRoughness; 219 # endif 220 221 # ifdef HAIR_SHADER 222 /* Add some variation to the hairs to avoid uniform look. */ 223 float hair_variation = hair_rand * 0.1; 224 color = clamp(color - hair_variation, 0.0, 1.0); 225 metallic = clamp(materialMetallic - hair_variation, 0.0, 1.0); 226 roughness = clamp(materialRoughness - hair_variation, 0.0, 1.0); 227 # endif 228 229 materialData.rgb = color.rgb; 230 materialData.a = workbench_float_pair_encode(roughness, metallic); 231 #endif /* MATDATA_PASS_ENABLED */ 232 233 #ifdef OBJECT_ID_PASS_ENABLED 234 objectId = uint(object_id); 235 #endif 236 237 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 238 vec3 n = (gl_FrontFacing) ? normal_viewport : -normal_viewport; 239 n = normalize(n); 240 normalViewport = workbench_normal_encode(n); 241 #endif 242 } Fragment shader failed to compile with the following errors: WARNING: 4:88: warning(#283) Implicit cast from int to uint ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int' ERROR: error(#273) 1 compilation errors. No code generated Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0064.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0064.frag GPUShader: compile error: **shader string 1** 1 #version 330 **shader string 2** **shader string 3** 2 #define GPU_ATI **shader string 4** 3 #define V3D_SHADING_OBJECT_OUTLINE 4 #define V3D_SHADING_SPECULAR_HIGHLIGHT 5 #define V3D_LIGHTING_STUDIO 6 #define OBJECT_ID_PASS_ENABLED 7 #define MATDATA_PASS_ENABLED 8 #define NORMAL_VIEWPORT_PASS_ENABLED 9 #define V3D_SHADING_TEXTURE_COLOR 10 #define WORKBENCH_ENCODE_NORMALS **shader string 5** 11 struct LightData { 12 vec4 direction; 13 vec4 specular_color; 14 vec4 diffuse_color_wrap; /* rgb: diffuse col a: wrapped lighting factor */ 15 }; 16 17 struct WorldData { 18 vec4 background_color_low; 19 vec4 background_color_high; 20 vec4 object_outline_color; 21 vec4 shadow_direction_vs; 22 LightData lights[4]; 23 vec4 ambient_color; 24 int num_lights; 25 int matcap_orientation; 26 float background_alpha; 27 float curvature_ridge; 28 float curvature_valley; 29 int pad[3]; 30 }; 31 #define NO_OBJECT_ID uint(0) 32 #define EPSILON 0.00001 33 #define M_PI 3.14159265358979323846 34 35 #define CAVITY_BUFFER_RANGE 4.0 36 37 /* 4x4 bayer matrix prepared for 8bit UNORM precision error. */ 38 #define P(x) (((x + 0.5) * (1.0 / 16.0) - 0.5) * (1.0 / 255.0)) 39 const vec4 dither_mat4x4- [x] = vec4[4]( 40 vec4( P(0.0), P(8.0), P(2.0), P(10.0)), 41 vec4(P(12.0), P(4.0), P(14.0), P(6.0)), 42 vec4( P(3.0), P(11.0), P(1.0), P(9.0)), 43 vec4(P(15.0), P(7.0), P(13.0), P(5.0)) 44 ); 45 46 float bayer_dither_noise() { 47 ivec2 tx1 = ivec2(gl_FragCoord.xy) % 4; 48 ivec2 tx2 = ivec2(gl_FragCoord.xy) % 2; 49 return dither_mat4x4[tx1.x][tx1.y]; 50 } 51 52 #ifdef WORKBENCH_ENCODE_NORMALS 53 54 #define WB_Normal vec2 55 56 /* From http://aras-p.info/texts/CompactNormalStorage.html 57 * Using Method #4: Spheremap Transform */ 58 vec3 workbench_normal_decode(WB_Normal enc) 59 { 60 vec2 fenc = enc.xy * 4.0 - 2.0; 61 float f = dot(fenc, fenc); 62 float g = sqrt(1.0 - f / 4.0); 63 vec3 n; 64 n.xy = fenc*g; 65 n.z = 1 - f / 2; 66 return n; 67 } 68 69 /* From http://aras-p.info/texts/CompactNormalStorage.html 70 * Using Method #4: Spheremap Transform */ 71 WB_Normal workbench_normal_encode(vec3 n) 72 { 73 float p = sqrt(n.z * 8.0 + 8.0); 74 n.xy = clamp(n.xy / p + 0.5, 0.0, 1.0); 75 return n.xy; 76 } 77 78 #else 79 #define WB_Normal vec3 80 /* Well just do nothing... */ 81 # define workbench_normal_encode(a) (a) 82 # define workbench_normal_decode(a) (a) 83 #endif /* WORKBENCH_ENCODE_NORMALS */ 84 85 /* Encoding into the alpha of a RGBA8 UNORM texture. */ 86 #define TARGET_BITCOUNT 8u 87 #define METALLIC_BITS 3u /* Metallic channel is less important. */ 88 #define ROUGHNESS_BITS (TARGET_BITCOUNT - METALLIC_BITS) 89 #define TOTAL_BITS (METALLIC_BITS + ROUGHNESS_BITS) 90 91 /* Encode 2 float into 1 with the desired precision. */ 92 float workbench_float_pair_encode(float v1, float v2) 93 { 94 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS); 95 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); 96 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); 97 int iv1 = int(v1 * float(v1_mask)); 98 int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS; 99 return float(iv1 | iv2) * (1.0 / float(total_mask)); 100 } 101 102 void workbench_float_pair_decode(float data, out float v1, out float v2) 103 { 104 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS); 105 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); 106 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); 107 uint idata = uint(data * float(total_mask)); 108 v1 = float(idata & v1_mask) * (1.0 / float(v1_mask)); 109 v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask)); 110 } 111 112 float calculate_transparent_weight(float z, float alpha) 113 { 114 #if 0 115 /* Eq 10 : Good for surfaces with varying opacity (like particles) */ 116 float a = min(1.0, alpha * 10.0) + 0.01; 117 float b = -gl_FragCoord.z * 0.95 + 1.0; 118 float w = a * a * a * 3e2 * b * b * b; 119 #else 120 /* Eq 7 put more emphasis on surfaces closer to the view. */ 121 // float w = 10.0 / (1e-5 + pow(abs(z) / 5.0, 2.0) + pow(abs(z) / 200.0, 6.0)); /* Eq 7 */ 122 // float w = 10.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0)); /* Eq 8 */ 123 // float w = 10.0 / (1e-5 + pow(abs(z) / 200.0, 4.0)); /* Eq 9 */ 124 /* Same as eq 7, but optimized. */ 125 float a = abs(z) / 5.0; 126 float b = abs(z) / 200.0; 127 b *= b; 128 float w = 10.0 / ((1e-5 + a * a) + b * (b * b)); /* Eq 7 */ 129 #endif 130 return alpha * clamp(w, 1e-2, 3e2); 131 } 132 133 /* Special function only to be used with calculate_transparent_weight(). */ 134 float linear_zdepth(float depth, vec4 viewvecs- [x], mat4 proj_mat) 135 { 136 if (proj_mat- [x]- [x] == 0.0) { 137 float d = 2.0 * depth - 1.0; 138 return -proj_mat- [x]- [x] / (d + proj_mat- [x][2]); 139 } 140 else { 141 /* Return depth from near plane. */ 142 return depth * viewvecs- [x].z; 143 } 144 } 145 146 vec3 view_vector_from_screen_uv(vec2 uv, vec4 viewvecs- [x], mat4 proj_mat) 147 { 148 return (proj_mat- [x]- [x] == 0.0) 149 ? normalize(viewvecs- [x].xyz + vec3(uv, 0.0) * viewvecs- [x].xyz) 150 : vec3(0.0, 0.0, 1.0); 151 } 152 153 vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped) 154 { 155 /* Quick creation of an orthonormal basis */ 156 float a = 1.0 / (1.0 + I.z); 157 float b = -I.x * I.y * a; 158 vec3 b1 = vec3(1.0 - I.x * I.x * a, b, -I.x); 159 vec3 b2 = vec3(b, 1.0 - I.y * I.y * a, -I.y); 160 vec2 matcap_uv = vec2(dot(b1, N), dot(b2, N)); 161 if (flipped) { 162 matcap_uv.x = -matcap_uv.x; 163 } 164 return matcap_uv * 0.496 + 0.5; 165 } 166 uniform int object_id = 0; 167 168 uniform vec3 materialDiffuseColor; 169 uniform float materialMetallic; 170 uniform float materialRoughness; 171 172 uniform sampler2D image; 173 uniform float ImageTransparencyCutoff = 0.1; 174 175 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 176 in vec3 normal_viewport; 177 #endif 178 179 #ifdef V3D_SHADING_TEXTURE_COLOR 180 in vec2 uv_interp; 181 #endif 182 183 #ifdef HAIR_SHADER 184 flat in float hair_rand; 185 #endif 186 187 #ifdef MATDATA_PASS_ENABLED 188 layout(location=0) out vec4 materialData; 189 #endif 190 #ifdef OBJECT_ID_PASS_ENABLED 191 layout(location=1) out uint objectId; 192 #endif 193 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 194 layout(location=2) out WB_Normal normalViewport; 195 #endif 196 197 void main() 198 { 199 #ifdef MATDATA_PASS_ENABLED 200 float metallic, roughness; 201 vec4 color; 202 203 # ifdef V3D_SHADING_TEXTURE_COLOR 204 color = texture(image, uv_interp); 205 if (color.a < ImageTransparencyCutoff) { 206 discard; 207 } 208 # else 209 color.rgb = materialDiffuseColor; 210 # endif 211 212 # ifdef V3D_LIGHTING_MATCAP 213 /* Encode front facing in metallic channel. */ 214 metallic = float(gl_FrontFacing); 215 roughness = 0.0; 216 # else 217 metallic = materialMetallic; 218 roughness = materialRoughness; 219 # endif 220 221 # ifdef HAIR_SHADER 222 /* Add some variation to the hairs to avoid uniform look. */ 223 float hair_variation = hair_rand * 0.1; 224 color = clamp(color - hair_variation, 0.0, 1.0); 225 metallic = clamp(materialMetallic - hair_variation, 0.0, 1.0); 226 roughness = clamp(materialRoughness - hair_variation, 0.0, 1.0); 227 # endif 228 229 materialData.rgb = color.rgb; 230 materialData.a = workbench_float_pair_encode(roughness, metallic); 231 #endif /* MATDATA_PASS_ENABLED */ 232 233 #ifdef OBJECT_ID_PASS_ENABLED 234 objectId = uint(object_id); 235 #endif 236 237 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 238 vec3 n = (gl_FrontFacing) ? normal_viewport : -normal_viewport; 239 n = normalize(n); 240 normalViewport = workbench_normal_encode(n); 241 #endif 242 } Fragment shader failed to compile with the following errors: WARNING: 4:88: warning(#283) Implicit cast from int to uint ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int' ERROR: error(#273) 1 compilation errors. No code generated Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0065.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0065.frag GPUShader: compile error: **shader string 1** 1 #version 330 **shader string 2** **shader string 3** 2 #define GPU_ATI **shader string 4** 3 #define V3D_SHADING_OBJECT_OUTLINE 4 #define V3D_SHADING_SPECULAR_HIGHLIGHT 5 #define V3D_LIGHTING_STUDIO 6 #define OBJECT_ID_PASS_ENABLED 7 #define MATDATA_PASS_ENABLED 8 #define NORMAL_VIEWPORT_PASS_ENABLED 9 #define V3D_SHADING_TEXTURE_COLOR 10 #define WORKBENCH_ENCODE_NORMALS 11 #define HAIR_SHADER **shader string 5** 12 struct LightData { 13 vec4 direction; 14 vec4 specular_color; 15 vec4 diffuse_color_wrap; /* rgb: diffuse col a: wrapped lighting factor */ 16 }; 17 18 struct WorldData { 19 vec4 background_color_low; 20 vec4 background_color_high; 21 vec4 object_outline_color; 22 vec4 shadow_direction_vs; 23 LightData lights[4]; 24 vec4 ambient_color; 25 int num_lights; 26 int matcap_orientation; 27 float background_alpha; 28 float curvature_ridge; 29 float curvature_valley; 30 int pad[3]; 31 }; 32 #define NO_OBJECT_ID uint(0) 33 #define EPSILON 0.00001 34 #define M_PI 3.14159265358979323846 35 36 #define CAVITY_BUFFER_RANGE 4.0 37 38 /* 4x4 bayer matrix prepared for 8bit UNORM precision error. */ 39 #define P(x) (((x + 0.5) * (1.0 / 16.0) - 0.5) * (1.0 / 255.0)) 40 const vec4 dither_mat4x4- [x] = vec4[4]( 41 vec4( P(0.0), P(8.0), P(2.0), P(10.0)), 42 vec4(P(12.0), P(4.0), P(14.0), P(6.0)), 43 vec4( P(3.0), P(11.0), P(1.0), P(9.0)), 44 vec4(P(15.0), P(7.0), P(13.0), P(5.0)) 45 ); 46 47 float bayer_dither_noise() { 48 ivec2 tx1 = ivec2(gl_FragCoord.xy) % 4; 49 ivec2 tx2 = ivec2(gl_FragCoord.xy) % 2; 50 return dither_mat4x4[tx1.x][tx1.y]; 51 } 52 53 #ifdef WORKBENCH_ENCODE_NORMALS 54 55 #define WB_Normal vec2 56 57 /* From http://aras-p.info/texts/CompactNormalStorage.html 58 * Using Method #4: Spheremap Transform */ 59 vec3 workbench_normal_decode(WB_Normal enc) 60 { 61 vec2 fenc = enc.xy * 4.0 - 2.0; 62 float f = dot(fenc, fenc); 63 float g = sqrt(1.0 - f / 4.0); 64 vec3 n; 65 n.xy = fenc*g; 66 n.z = 1 - f / 2; 67 return n; 68 } 69 70 /* From http://aras-p.info/texts/CompactNormalStorage.html 71 * Using Method #4: Spheremap Transform */ 72 WB_Normal workbench_normal_encode(vec3 n) 73 { 74 float p = sqrt(n.z * 8.0 + 8.0); 75 n.xy = clamp(n.xy / p + 0.5, 0.0, 1.0); 76 return n.xy; 77 } 78 79 #else 80 #define WB_Normal vec3 81 /* Well just do nothing... */ 82 # define workbench_normal_encode(a) (a) 83 # define workbench_normal_decode(a) (a) 84 #endif /* WORKBENCH_ENCODE_NORMALS */ 85 86 /* Encoding into the alpha of a RGBA8 UNORM texture. */ 87 #define TARGET_BITCOUNT 8u 88 #define METALLIC_BITS 3u /* Metallic channel is less important. */ 89 #define ROUGHNESS_BITS (TARGET_BITCOUNT - METALLIC_BITS) 90 #define TOTAL_BITS (METALLIC_BITS + ROUGHNESS_BITS) 91 92 /* Encode 2 float into 1 with the desired precision. */ 93 float workbench_float_pair_encode(float v1, float v2) 94 { 95 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS); 96 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); 97 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); 98 int iv1 = int(v1 * float(v1_mask)); 99 int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS; 100 return float(iv1 | iv2) * (1.0 / float(total_mask)); 101 } 102 103 void workbench_float_pair_decode(float data, out float v1, out float v2) 104 { 105 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS); 106 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); 107 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); 108 uint idata = uint(data * float(total_mask)); 109 v1 = float(idata & v1_mask) * (1.0 / float(v1_mask)); 110 v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask)); 111 } 112 113 float calculate_transparent_weight(float z, float alpha) 114 { 115 #if 0 116 /* Eq 10 : Good for surfaces with varying opacity (like particles) */ 117 float a = min(1.0, alpha * 10.0) + 0.01; 118 float b = -gl_FragCoord.z * 0.95 + 1.0; 119 float w = a * a * a * 3e2 * b * b * b; 120 #else 121 /* Eq 7 put more emphasis on surfaces closer to the view. */ 122 // float w = 10.0 / (1e-5 + pow(abs(z) / 5.0, 2.0) + pow(abs(z) / 200.0, 6.0)); /* Eq 7 */ 123 // float w = 10.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0)); /* Eq 8 */ 124 // float w = 10.0 / (1e-5 + pow(abs(z) / 200.0, 4.0)); /* Eq 9 */ 125 /* Same as eq 7, but optimized. */ 126 float a = abs(z) / 5.0; 127 float b = abs(z) / 200.0; 128 b *= b; 129 float w = 10.0 / ((1e-5 + a * a) + b * (b * b)); /* Eq 7 */ 130 #endif 131 return alpha * clamp(w, 1e-2, 3e2); 132 } 133 134 /* Special function only to be used with calculate_transparent_weight(). */ 135 float linear_zdepth(float depth, vec4 viewvecs- [x], mat4 proj_mat) 136 { 137 if (proj_mat- [x]- [x] == 0.0) { 138 float d = 2.0 * depth - 1.0; 139 return -proj_mat- [x]- [x] / (d + proj_mat- [x][2]); 140 } 141 else { 142 /* Return depth from near plane. */ 143 return depth * viewvecs- [x].z; 144 } 145 } 146 147 vec3 view_vector_from_screen_uv(vec2 uv, vec4 viewvecs- [x], mat4 proj_mat) 148 { 149 return (proj_mat- [x]- [x] == 0.0) 150 ? normalize(viewvecs- [x].xyz + vec3(uv, 0.0) * viewvecs- [x].xyz) 151 : vec3(0.0, 0.0, 1.0); 152 } 153 154 vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped) 155 { 156 /* Quick creation of an orthonormal basis */ 157 float a = 1.0 / (1.0 + I.z); 158 float b = -I.x * I.y * a; 159 vec3 b1 = vec3(1.0 - I.x * I.x * a, b, -I.x); 160 vec3 b2 = vec3(b, 1.0 - I.y * I.y * a, -I.y); 161 vec2 matcap_uv = vec2(dot(b1, N), dot(b2, N)); 162 if (flipped) { 163 matcap_uv.x = -matcap_uv.x; 164 } 165 return matcap_uv * 0.496 + 0.5; 166 } 167 uniform int object_id = 0; 168 169 uniform vec3 materialDiffuseColor; 170 uniform float materialMetallic; 171 uniform float materialRoughness; 172 173 uniform sampler2D image; 174 uniform float ImageTransparencyCutoff = 0.1; 175 176 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 177 in vec3 normal_viewport; 178 #endif 179 180 #ifdef V3D_SHADING_TEXTURE_COLOR 181 in vec2 uv_interp; 182 #endif 183 184 #ifdef HAIR_SHADER 185 flat in float hair_rand; 186 #endif 187 188 #ifdef MATDATA_PASS_ENABLED 189 layout(location=0) out vec4 materialData; 190 #endif 191 #ifdef OBJECT_ID_PASS_ENABLED 192 layout(location=1) out uint objectId; 193 #endif 194 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 195 layout(location=2) out WB_Normal normalViewport; 196 #endif 197 198 void main() 199 { 200 #ifdef MATDATA_PASS_ENABLED 201 float metallic, roughness; 202 vec4 color; 203 204 # ifdef V3D_SHADING_TEXTURE_COLOR 205 color = texture(image, uv_interp); 206 if (color.a < ImageTransparencyCutoff) { 207 discard; 208 } 209 # else 210 color.rgb = materialDiffuseColor; 211 # endif 212 213 # ifdef V3D_LIGHTING_MATCAP 214 /* Encode front facing in metallic channel. */ 215 metallic = float(gl_FrontFacing); 216 roughness = 0.0; 217 # else 218 metallic = materialMetallic; 219 roughness = materialRoughness; 220 # endif 221 222 # ifdef HAIR_SHADER 223 /* Add some variation to the hairs to avoid uniform look. */ 224 float hair_variation = hair_rand * 0.1; 225 color = clamp(color - hair_variation, 0.0, 1.0); 226 metallic = clamp(materialMetallic - hair_variation, 0.0, 1.0); 227 roughness = clamp(materialRoughness - hair_variation, 0.0, 1.0); 228 # endif 229 230 materialData.rgb = color.rgb; 231 materialData.a = workbench_float_pair_encode(roughness, metallic); 232 #endif /* MATDATA_PASS_ENABLED */ 233 234 #ifdef OBJECT_ID_PASS_ENABLED 235 objectId = uint(object_id); 236 #endif 237 238 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 239 vec3 n = (gl_FrontFacing) ? normal_viewport : -normal_viewport; 240 n = normalize(n); 241 normalViewport = workbench_normal_encode(n); 242 #endif 243 } Fragment shader failed to compile with the following errors: WARNING: 4:88: warning(#283) Implicit cast from int to uint ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int' ERROR: error(#273) 1 compilation errors. No code generated Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0066.vert Shader file written to disk: C:\Users\ADMINI~1\AppData\Local\Temp\blender_a02656\0066.frag GPUShader: compile error: **shader string 1** 1 #version 330 **shader string 2** **shader string 3** 2 #define GPU_ATI **shader string 4** 3 #define V3D_SHADING_OBJECT_OUTLINE 4 #define V3D_SHADING_SPECULAR_HIGHLIGHT 5 #define V3D_LIGHTING_STUDIO 6 #define OBJECT_ID_PASS_ENABLED 7 #define MATDATA_PASS_ENABLED 8 #define NORMAL_VIEWPORT_PASS_ENABLED 9 #define WORKBENCH_ENCODE_NORMALS **shader string 5** 10 struct LightData { 11 vec4 direction; 12 vec4 specular_color; 13 vec4 diffuse_color_wrap; /* rgb: diffuse col a: wrapped lighting factor */ 14 }; 15 16 struct WorldData { 17 vec4 background_color_low; 18 vec4 background_color_high; 19 vec4 object_outline_color; 20 vec4 shadow_direction_vs; 21 LightData lights[4]; 22 vec4 ambient_color; 23 int num_lights; 24 int matcap_orientation; 25 float background_alpha; 26 float curvature_ridge; 27 float curvature_valley; 28 int pad[3]; 29 }; 30 #define NO_OBJECT_ID uint(0) 31 #define EPSILON 0.00001 32 #define M_PI 3.14159265358979323846 33 34 #define CAVITY_BUFFER_RANGE 4.0 35 36 /* 4x4 bayer matrix prepared for 8bit UNORM precision error. */ 37 #define P(x) (((x + 0.5) * (1.0 / 16.0) - 0.5) * (1.0 / 255.0)) 38 const vec4 dither_mat4x4- [x] = vec4[4]( 39 vec4( P(0.0), P(8.0), P(2.0), P(10.0)), 40 vec4(P(12.0), P(4.0), P(14.0), P(6.0)), 41 vec4( P(3.0), P(11.0), P(1.0), P(9.0)), 42 vec4(P(15.0), P(7.0), P(13.0), P(5.0)) 43 ); 44 45 float bayer_dither_noise() { 46 ivec2 tx1 = ivec2(gl_FragCoord.xy) % 4; 47 ivec2 tx2 = ivec2(gl_FragCoord.xy) % 2; 48 return dither_mat4x4[tx1.x][tx1.y]; 49 } 50 51 #ifdef WORKBENCH_ENCODE_NORMALS 52 53 #define WB_Normal vec2 54 55 /* From http://aras-p.info/texts/CompactNormalStorage.html 56 * Using Method #4: Spheremap Transform */ 57 vec3 workbench_normal_decode(WB_Normal enc) 58 { 59 vec2 fenc = enc.xy * 4.0 - 2.0; 60 float f = dot(fenc, fenc); 61 float g = sqrt(1.0 - f / 4.0); 62 vec3 n; 63 n.xy = fenc*g; 64 n.z = 1 - f / 2; 65 return n; 66 } 67 68 /* From http://aras-p.info/texts/CompactNormalStorage.html 69 * Using Method #4: Spheremap Transform */ 70 WB_Normal workbench_normal_encode(vec3 n) 71 { 72 float p = sqrt(n.z * 8.0 + 8.0); 73 n.xy = clamp(n.xy / p + 0.5, 0.0, 1.0); 74 return n.xy; 75 } 76 77 #else 78 #define WB_Normal vec3 79 /* Well just do nothing... */ 80 # define workbench_normal_encode(a) (a) 81 # define workbench_normal_decode(a) (a) 82 #endif /* WORKBENCH_ENCODE_NORMALS */ 83 84 /* Encoding into the alpha of a RGBA8 UNORM texture. */ 85 #define TARGET_BITCOUNT 8u 86 #define METALLIC_BITS 3u /* Metallic channel is less important. */ 87 #define ROUGHNESS_BITS (TARGET_BITCOUNT - METALLIC_BITS) 88 #define TOTAL_BITS (METALLIC_BITS + ROUGHNESS_BITS) 89 90 /* Encode 2 float into 1 with the desired precision. */ 91 float workbench_float_pair_encode(float v1, float v2) 92 { 93 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS); 94 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); 95 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); 96 int iv1 = int(v1 * float(v1_mask)); 97 int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS; 98 return float(iv1 | iv2) * (1.0 / float(total_mask)); 99 } 100 101 void workbench_float_pair_decode(float data, out float v1, out float v2) 102 { 103 const uint total_mask = ~(0xFFFFFFFFu << TOTAL_BITS); 104 const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); 105 const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); 106 uint idata = uint(data * float(total_mask)); 107 v1 = float(idata & v1_mask) * (1.0 / float(v1_mask)); 108 v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask)); 109 } 110 111 float calculate_transparent_weight(float z, float alpha) 112 { 113 #if 0 114 /* Eq 10 : Good for surfaces with varying opacity (like particles) */ 115 float a = min(1.0, alpha * 10.0) + 0.01; 116 float b = -gl_FragCoord.z * 0.95 + 1.0; 117 float w = a * a * a * 3e2 * b * b * b; 118 #else 119 /* Eq 7 put more emphasis on surfaces closer to the view. */ 120 // float w = 10.0 / (1e-5 + pow(abs(z) / 5.0, 2.0) + pow(abs(z) / 200.0, 6.0)); /* Eq 7 */ 121 // float w = 10.0 / (1e-5 + pow(abs(z) / 10.0, 3.0) + pow(abs(z) / 200.0, 6.0)); /* Eq 8 */ 122 // float w = 10.0 / (1e-5 + pow(abs(z) / 200.0, 4.0)); /* Eq 9 */ 123 /* Same as eq 7, but optimized. */ 124 float a = abs(z) / 5.0; 125 float b = abs(z) / 200.0; 126 b *= b; 127 float w = 10.0 / ((1e-5 + a * a) + b * (b * b)); /* Eq 7 */ 128 #endif 129 return alpha * clamp(w, 1e-2, 3e2); 130 } 131 132 /* Special function only to be used with calculate_transparent_weight(). */ 133 float linear_zdepth(float depth, vec4 viewvecs- [x], mat4 proj_mat) 134 { 135 if (proj_mat- [x]- [x] == 0.0) { 136 float d = 2.0 * depth - 1.0; 137 return -proj_mat- [x]- [x] / (d + proj_mat- [x][2]); 138 } 139 else { 140 /* Return depth from near plane. */ 141 return depth * viewvecs- [x].z; 142 } 143 } 144 145 vec3 view_vector_from_screen_uv(vec2 uv, vec4 viewvecs- [x], mat4 proj_mat) 146 { 147 return (proj_mat- [x]- [x] == 0.0) 148 ? normalize(viewvecs- [x].xyz + vec3(uv, 0.0) * viewvecs- [x].xyz) 149 : vec3(0.0, 0.0, 1.0); 150 } 151 152 vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped) 153 { 154 /* Quick creation of an orthonormal basis */ 155 float a = 1.0 / (1.0 + I.z); 156 float b = -I.x * I.y * a; 157 vec3 b1 = vec3(1.0 - I.x * I.x * a, b, -I.x); 158 vec3 b2 = vec3(b, 1.0 - I.y * I.y * a, -I.y); 159 vec2 matcap_uv = vec2(dot(b1, N), dot(b2, N)); 160 if (flipped) { 161 matcap_uv.x = -matcap_uv.x; 162 } 163 return matcap_uv * 0.496 + 0.5; 164 } 165 vec3 background_color(WorldData world_data, float y) { 166 return mix(world_data.background_color_low, world_data.background_color_high, y).xyz + bayer_dither_noise(); 167 } 168 169 /* [Drobot2014a] Low Level Optimizations for GCN */ 170 vec4 fast_rcp(vec4 v) 171 { 172 return intBitsToFloat(0x7eef370b - floatBitsToInt(v)); 173 } 174 175 vec3 brdf_approx(vec3 spec_color, float roughness, float NV) 176 { 177 /* Very rough own approx. We don't need it to be correct, just fast. 178 * Just simulate fresnel effect with roughness attenuation. */ 179 float fresnel = exp2(-8.35 * NV) * (1.0 - roughness); 180 return mix(spec_color, vec3(1.0), fresnel); 181 } 182 183 void prep_specular( 184 vec3 L, vec3 I, vec3 N, vec3 R, 185 out float NL, out float wrapped_NL, out float spec_angle) 186 { 187 wrapped_NL = dot(L, R); 188 vec3 half_dir = normalize(L + I); 189 spec_angle = clamp(dot(half_dir, N), 0.0, 1.0); 190 NL = clamp(dot(L, N), 0.0, 1.0); 191 } 192 193 /* Normalized Blinn shading */ 194 vec4 blinn_specular(vec4 shininess, vec4 spec_angle, vec4 NL) 195 { 196 /* Pi is already divided in the lamp power. 197 * normalization_factor = (shininess + 8.0) / (8.0 * M_PI) */ 198 vec4 normalization_factor = shininess * 0.125 + 1.0; 199 vec4 spec_light = pow(spec_angle, shininess) * NL * normalization_factor; 200 201 return spec_light; 202 } 203 204 /* NL need to be unclamped. w in [0..1] range. */ 205 vec4 wrapped_lighting(vec4 NL, vec4 w) 206 { 207 vec4 w_1 = w + 1.0; 208 vec4 denom = fast_rcp(w_1 * w_1); 209 return clamp((NL + w) * denom, 0.0, 1.0); 210 } 211 212 vec3 get_world_lighting( 213 WorldData world_data, 214 vec3 diffuse_color, vec3 specular_color, float roughness, 215 vec3 N, vec3 I) 216 { 217 vec3 specular_light = world_data.ambient_color.rgb; 218 vec3 diffuse_light = world_data.ambient_color.rgb; 219 vec4 wrap = vec4( 220 world_data.lights- [x].diffuse_color_wrap.a, 221 world_data.lights- [x].diffuse_color_wrap.a, 222 world_data.lights- [x].diffuse_color_wrap.a, 223 world_data.lights- [x].diffuse_color_wrap.a 224 ); 225 226 #ifdef V3D_SHADING_SPECULAR_HIGHLIGHT 227 /* Prepare Specular computation. Eval 4 lights at once. */ 228 vec3 R = -reflect(I, N); 229 vec4 spec_angle, spec_NL, wrap_NL; 230 prep_specular(world_data.lights- [x].direction.xyz, I, N, R, spec_NL.x, wrap_NL.x, spec_angle.x); 231 prep_specular(world_data.lights- [x].direction.xyz, I, N, R, spec_NL.y, wrap_NL.y, spec_angle.y); 232 prep_specular(world_data.lights- [x].direction.xyz, I, N, R, spec_NL.z, wrap_NL.z, spec_angle.z); 233 prep_specular(world_data.lights- [x].direction.xyz, I, N, R, spec_NL.w, wrap_NL.w, spec_angle.w); 234 235 vec4 gloss = vec4(1.0 - roughness); 236 /* Reduce gloss for smooth light. (simulate bigger light) */ 237 gloss *= 1.0 - wrap; 238 vec4 shininess = exp2(10.0 * gloss + 1.0); 239 240 vec4 spec_light = blinn_specular(shininess, spec_angle, spec_NL); 241 242 /* Simulate Env. light. */ 243 vec4 w = mix(wrap, vec4(1.0), roughness); 244 vec4 spec_env = wrapped_lighting(wrap_NL, w); 245 246 spec_light = mix(spec_light, spec_env, wrap * wrap); 247 248 /* Multiply result by lights specular colors. */ 249 specular_light += spec_light.x * world_data.lights- [x].specular_color.rgb; 250 specular_light += spec_light.y * world_data.lights- [x].specular_color.rgb; 251 specular_light += spec_light.z * world_data.lights- [x].specular_color.rgb; 252 specular_light += spec_light.w * world_data.lights- [x].specular_color.rgb; 253 254 float NV = clamp(dot(N, I), 0.0, 1.0); 255 specular_color = brdf_approx(specular_color, roughness, NV); 256 #endif 257 specular_light *= specular_color; 258 259 /* Prepare diffuse computation. Eval 4 lights at once. */ 260 vec4 diff_NL; 261 diff_NL.x = dot(world_data.lights- [x].direction.xyz, N); 262 diff_NL.y = dot(world_data.lights- [x].direction.xyz, N); 263 diff_NL.z = dot(world_data.lights- [x].direction.xyz, N); 264 diff_NL.w = dot(world_data.lights- [x].direction.xyz, N); 265 266 vec4 diff_light = wrapped_lighting(diff_NL, wrap); 267 268 /* Multiply result by lights diffuse colors. */ 269 diffuse_light += diff_light.x * world_data.lights- [x].diffuse_color_wrap.rgb; 270 diffuse_light += diff_light.y * world_data.lights- [x].diffuse_color_wrap.rgb; 271 diffuse_light += diff_light.z * world_data.lights- [x].diffuse_color_wrap.rgb; 272 diffuse_light += diff_light.w * world_data.lights- [x].diffuse_color_wrap.rgb; 273 274 /* Energy conservation with colored specular look strange. 275 * Limit this strangeness by using mono-chromatic specular intensity. */ 276 float spec_energy = dot(specular_color, vec3(0.33333)); 277 278 diffuse_light *= diffuse_color * (1.0 - spec_energy); 279 280 return diffuse_light + specular_light; 281 } 282 #define OBJECT_OUTLINE_OFFSET 1 283 284 float calculate_object_outline(usampler2D objectId, ivec2 texel, uint object_id) 285 { 286 uvec4 oid_offset = uvec4( 287 texelFetchOffset(objectId, texel, 0, ivec2(0, OBJECT_OUTLINE_OFFSET)).r, 288 texelFetchOffset(objectId, texel, 0, ivec2(0, -OBJECT_OUTLINE_OFFSET)).r, 289 texelFetchOffset(objectId, texel, 0, ivec2(-OBJECT_OUTLINE_OFFSET, 0)).r, 290 texelFetchOffset(objectId, texel, 0, ivec2( OBJECT_OUTLINE_OFFSET, 0)).r); 291 292 return dot(vec4(equal(uvec4(object_id), oid_offset)), vec4(0.25)); 293 } 294 out vec4 fragColor; 295 296 uniform mat4 ProjectionMatrix; 297 uniform mat4 ViewMatrixInverse; 298 299 uniform usampler2D objectId; 300 uniform sampler2D materialBuffer; 301 uniform sampler2D normalBuffer; 302 /* normalBuffer contains viewport normals */ 303 uniform sampler2D cavityBuffer; 304 uniform sampler2D matcapImage; 305 306 uniform vec2 invertedViewportSize; 307 uniform vec4 viewvecs[3]; 308 uniform float shadowMultiplier; 309 uniform float lightMultiplier; 310 uniform float shadowShift = 0.1; 311 uniform float shadowFocus = 1.0; 312 313 uniform vec3 materialSingleColor; 314 315 layout(std140) uniform world_block { 316 WorldData world_data; 317 }; 318 319 void main() 320 { 321 ivec2 texel = ivec2(gl_FragCoord.xy); 322 vec2 uv_viewport = gl_FragCoord.xy * invertedViewportSize; 323 324 float roughness, metallic; 325 vec3 base_color; 326 327 #ifndef MATDATA_PASS_ENABLED 328 base_color = materialSingleColor; 329 metallic = 0.0; 330 roughness = 0.5; 331 #else 332 vec4 material_data = texelFetch(materialBuffer, texel, 0); 333 base_color = material_data.rgb; 334 workbench_float_pair_decode(material_data.a, roughness, metallic); 335 #endif 336 337 /* Do we need normals */ 338 #ifdef NORMAL_VIEWPORT_PASS_ENABLED 339 vec3 normal_viewport = workbench_normal_decode(texelFetch(normalBuffer, texel, 0).rg); 340 #endif 341 342 vec3 I_vs = view_vector_from_screen_uv(uv_viewport, viewvecs, ProjectionMatrix); 343 344 /* -------- SHADING --------- */ 345 #ifdef V3D_LIGHTING_FLAT 346 vec3 shaded_color = base_color; 347 348 #elif defined(V3D_LIGHTING_MATCAP) 349 /* When using matcaps, the metallic is the backface sign. */ 350 normal_viewport = (metallic > 0.0) ? normal_viewport : -normal_viewport; 351 bool flipped = world_data.matcap_orientation != 0; 352 vec2 matcap_uv = matcap_uv_compute(I_vs, normal_viewport, flipped); 353 vec3 matcap = textureLod(matcapImage, matcap_uv, 0.0).rgb; 354 vec3 shaded_color = matcap * base_color; 355 356 #elif defined(V3D_LIGHTING_STUDIO) 357 358 # ifdef V3D_SHADING_SPECULAR_HIGHLIGHT 359 vec3 specular_color = mix(vec3(0.05), base_color, metallic); 360 vec3 diffuse_color = mix(base_color, vec3(0.0), metallic); 361 # else 362 roughness = 0.0; 363 vec3 specular_color = vec3(0.0); 364 vec3 diffuse_color = base_color; 365 # endif 366 367 vec3 shaded_color = get_world_lighting(world_data, 368 diffuse_color, specular_color, roughness, 369 normal_viewport, I_vs); 370 #endif 371 372 /* -------- POST EFFECTS --------- */ 373 #ifdef WB_CAVITY 374 /* Using UNORM texture so decompress the range */ 375 shaded_color *= texelFetch(cavityBuffer, texel, 0).r * CAVITY_BUFFER_RANGE; 376 #endif 377 378 #ifdef V3D_SHADING_SHADOW 379 float light_factor = -dot(normal_viewport, world_data.shadow_direction_vs.xyz); 380 float shadow_mix = smoothstep(shadowFocus, shadowShift, light_factor); 381 shaded_color *= mix(lightMultiplier, shadowMultiplier, shadow_mix); 382 #endif 383 384 #ifdef V3D_SHADING_OBJECT_OUTLINE 385 uint object_id = texelFetch(objectId, texel, 0).r; 386 float object_outline = calculate_object_outline(objectId, texel, object_id); 387 shaded_color = mix(world_data.object_outline_color.rgb, shaded_color, object_outline); 388 #endif 389 390 fragColor = vec4(shaded_color, 1.0); 391 } Fragment shader failed to compile with the following errors: WARNING: 4:88: warning(#283) Implicit cast from int to uint ERROR: 4:88: error(#160) Cannot convert from 'unsigned int' to 'mediump int' ERROR: error(#273) 1 compilation errors. No code generated
Author

Added subscriber: @TwingSister

Added subscriber: @TwingSister

Closed as duplicate of #59182

Closed as duplicate of #59182
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
2 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#59361
No description provided.