-
Notifications
You must be signed in to change notification settings - Fork 34
Add lights attributes #242
base: master
Are you sure you want to change the base?
Conversation
--message=modified lighting formula
modified lighting formula in uv_normal.frag
Modified lighting formula with fixed eye
Sorry for the multiplication of the updates. I hope, it should be stabilized now. |
Sorry, I will need to take a close look at this... I'd really just hope to address this with some nice looking julia code + transpiler at some point :P |
No problem at all: this is not an emergency and the proposed approach is for sure not completely satisfactory.. |
Anything new regarding lighting? I noticed frag files changed in GLMakie since this tentative :-). Is it now possible to have a more uniform lighting in 3D? Add several lights? etc. |
Sorry, no ;) Would still be nice to have of course |
What do you think about extending your light_calc function to define other lighting styles? |
Actually, this simple hack makes it possible for me to obtain a uniform lighting just by extending |
No, that's likely a bug ;) |
I tried to fix it without success, sorry! mutable struct Lights
description::String
intensity::Array{Float64, 1}
end
function GLMakie.GLVisualize.light_calc(x::Lights)
if x.description == "uniform"
ST = [ 0.0 0.0 1.73205; 1.63299 0.0 -0.57735;
-0.816497 1.41421 -0.57735; -0.816497 -1.41421 -0.57735]
lights = [Vec3f0(ST[k, :]...) for k = 1:size(ST, 1)]
strl = """
vec3 L = normalize(o_lightdir);
vec3 N = normalize(o_normal);\n"""
for k = 1:size(lights, 1)
strl = strl * "vec3 light" * string(k) * " = blinnphong(N, o_vertex," *
"vec3(" * string(lights[k][1]) * "," *
string(lights[k][2]) * "," *
string(lights[k][3]) * ")" *
", color.rgb); \n"
end
strl = strl * "color = vec4(light1 * " * string(x.intensity[1]) * " + " *
"light2 * " * string(x.intensity[2]) * " + " *
"light3 * " * string(x.intensity[3]) * " + " *
"light4 * " * string(x.intensity[4]) * ", color.a);"
#println(strl)
strl
else
""
end
end |
..with the option |
Actually, the meshscatter!(..., shading = false) but I am not able to identify the path from |
Finally, I managed to fix this (shading not taken into account in meshscatter) by some modification in
"light_calc" => light_calc(shading) in particles.jl in the
Are you interested in a PR for this small extension? |
That'd be awesome :) Thanks for your work on this, and sorry that I have this on low priority and therefore am not very responsive :D |
No problem at all: you are right, this is definitely low priority! |
light
field (with backlighting)assemble_shader
inutils.jl
is the right place to add lighting optionsvalue
calls to transform signals. I guess there is still some work to be done to preserve interactivity.. At least it should not affectMakie
calls.