Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_material.c
| Context not available. | |||||
| return material->bound; | return material->bound; | ||||
| } | } | ||||
| Scene *GPU_material_scene(GPUMaterial *material) | |||||
| { | |||||
| return material->scene; | |||||
| } | |||||
| void GPU_material_vertex_attributes(GPUMaterial *material, GPUVertexAttribs *attribs) | void GPU_material_vertex_attributes(GPUMaterial *material, GPUVertexAttribs *attribs) | ||||
| { | { | ||||
| *attribs = material->attribs; | *attribs = material->attribs; | ||||
| Context not available. | |||||
| GPU_link(mat, "set_rgb_zero", &shr->spec); | GPU_link(mat, "set_rgb_zero", &shr->spec); | ||||
| GPU_link(mat, "set_value", shi->alpha, &shr->alpha); | GPU_link(mat, "set_value", shi->alpha, &shr->alpha); | ||||
| shr->combined = shr->diff; | shr->combined = shr->diff; | ||||
| if (ma->nodetree && ma->use_nodes) { | |||||
| bNode *node; | |||||
| for (node = ma->nodetree->nodes.first; node; node = node->next) { | |||||
| if (node->type == SH_NODE_LAMP) { | |||||
| material_lights(shi, shr); | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
brecht: I don't fully understand what is going on here, but it seems like this code is in the wrong… | |||||
irieAuthorUnsubmitted Not Done Inline ActionsProbably you are right. For shadeless materials this node often fails to output the correct values. Will look into this more carefully. irie: Probably you are right. For shadeless materials this node often fails to output the correct… | |||||
irieAuthorUnsubmitted Not Done Inline ActionsAh sorry, the failures happened only when I removed this code for testing. So far this works as I expect. Anyway I'll investigate if there is better way. irie: Ah sorry, the failures happened only when I removed this code for testing. So far this works… | |||||
| } | } | ||||
| else { | else { | ||||
| if (GPU_link_changed(shi->emit) || ma->emit != 0.0f) { | if (GPU_link_changed(shi->emit) || ma->emit != 0.0f) { | ||||
| Context not available. | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| GPUNodeLink *GPU_lamp_get_info(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **col, GPUNodeLink **lv, GPUNodeLink **dist, GPUNodeLink **shadfac) | |||||
| { | |||||
| GPUNodeLink *visifac; | |||||
| *col = GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob); | |||||
brechtUnsubmitted Not Done Inline ActionsProbably you want to allow texturing the light color here with shade_light_textures, sample as in shade_one_light. Also missing here seems to be lamp energy? brecht: Probably you want to allow texturing the light color here with shade_light_textures, sample as… | |||||
irieAuthorUnsubmitted Not Done Inline ActionsThis is for variance shadow maps in the gameengine. So far it seems to work correctly. irie: This is for variance shadow maps in the gameengine. So far it seems to work correctly.
The… | |||||
| visifac = lamp_get_visibility(mat, lamp, lv, dist); | |||||
| if (GPU_lamp_has_shadow_buffer(lamp)) { | |||||
| GPUNodeLink *vn, *inp; | |||||
| GPU_link(mat, "shade_norm", GPU_builtin(GPU_VIEW_NORMAL), &vn); | |||||
| GPU_link(mat, "shade_inp", vn, *lv, &inp); | |||||
| if (lamp->la->shadowmap_type == LA_SHADMAP_VARIANCE) { | |||||
| GPU_link(mat, "shadows_only_vsm", | |||||
| GPU_builtin(GPU_VIEW_POSITION), | |||||
| GPU_dynamic_texture(lamp->tex, GPU_DYNAMIC_SAMPLER_2DSHADOW, lamp->ob), | |||||
| GPU_dynamic_uniform((float*)lamp->dynpersmat, GPU_DYNAMIC_LAMP_DYNPERSMAT, lamp->ob), | |||||
| GPU_uniform(&lamp->bias), GPU_uniform(&lamp->la->bleedbias), inp, shadfac); | |||||
| } | |||||
| else { | |||||
| GPU_link(mat, "shadows_only", | |||||
| GPU_builtin(GPU_VIEW_POSITION), | |||||
| GPU_dynamic_texture(lamp->tex, GPU_DYNAMIC_SAMPLER_2DSHADOW, lamp->ob), | |||||
| GPU_dynamic_uniform((float*)lamp->dynpersmat, GPU_DYNAMIC_LAMP_DYNPERSMAT, lamp->ob), | |||||
| GPU_uniform(&lamp->bias), inp, shadfac); | |||||
| } | |||||
| } | |||||
| else { | |||||
| GPU_link(mat, "set_value_one", shadfac); | |||||
| } | |||||
| return visifac; | |||||
| } | |||||
| /* export the GLSL shader */ | /* export the GLSL shader */ | ||||
| GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma) | GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma) | ||||
| Context not available. | |||||
I don't fully understand what is going on here, but it seems like this code is in the wrong place.
I'm guessing it is because there is some case where lamps are not getting initialized for the Lamp Data node, but then this code does not actually solve the problem, but only when you have a shader node setup with a material node with a shadeless material in it.