我正在尝试实现GLSL着色器,该着色器将突出显示渲染的3D网格的外部边缘。问题是我无权访问OpenGL客户端代码,因此只能在GLSL着色器中完成。
我的第一个尝试是从Unity使用/采用此着色器,并在OpenGL GLSL中进行操作。这里看起来应该是这样:
这是我得到的:
我不确定我是否可以正确计算内容,但是如您所见,输出与我的期望值相差甚远。
这是食人魔的材料
material Chassis
{
technique
{
pass standard
{
cull_software back
scene_blend zero one
}
pass psssm
{
cull_software front
scene_blend src_alpha one_minus_src_alpha
vertex_program_ref reflection_cube_specularmap_normalmap_vs100
{
param_named_auto modelViewProjectionMatrix worldviewproj_matrix
param_named_auto normalMatrix inverse_transpose_world_matrix
param_named_auto modelView worldview_matrix
param_named_auto camera_world_position camera_position
param_named_auto inverse_projection_matrix inverse_projection_matrix
param_named_auto projection_matrix projection_matrix
param_named_auto p_InverseModelView inverse_worldview_matrix
}
fragment_program_ref reflection_cube_specularmap_normalmap_fs100
{
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是顶点着色器
material Chassis
{
technique
{ …
Run Code Online (Sandbox Code Playgroud)