我正在尝试从此处实现以下着色器: https://gamedev.stackexchange.com/questions/68401/how-can-i-draw-outlines-around-3d-models
我的基础是带有预先应用的着色器的2D图像。
我不确定如何应用
glDrawBuffer( GL_COLOR_ATTACHMENT1 );
Vec3f clearVec( 0.0, 0.0, -1.0f );
// from normalized vector to rgb color; from [-1,1] to [0,1]
clearVec = (clearVec + Vec3f(1.0f, 1.0f, 1.0f)) * 0.5f;
glClearColor( clearVec.x, clearVec.y, clearVec.z, 0.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
所以我没有,这就是我的QML代码:
ShaderEffect {
id: outline
anchors.fill: swirls
visible: true
property variant source: swirls
//property variant source: mascot
// first render target from the first pass
property variant uTexColor: swirls
// second render target from the first pass
property variant uTexNormals: swirls
property variant uResolution: Qt.vector2d(960, 640) //screen resolution
property variant delta: Qt.size(0.1 / width, 0.2 / height)
fragmentShader: "qrc:effects/shaders/outline.frag"
layer.enabled: true
layer.effect: OpacityMask {
maskSource: swirls
}
}
我对正常的扩散贴图不太了解,也不知道什么
in vec2 fsInUV;
对于使它正常工作似乎很重要。我正在尝试用不透明蒙版+着色器围绕动画创建一个像轮廓一样的精灵(动画效果看起来像是带有着色器的水)
着色器的原始用户不活跃,我对QML如何实现着色器不熟悉,因为我通常对着色器不熟悉。