[About macOS Sequoia] (Updated October 22, 2024)
Live2D Cubism Editor 5.1.02 now supports macOS Sequoia.
Other Live2D Cubism products currently released are not guaranteed to work on macOS Sequoia.
Please refrain from upgrading macOS, as it may not operate properly.
Changing model fragment shader(android opengl es)
I am trying to change a model color, adding effects to it using fragment shader
how do I get/change the model fragment shader in order to get needed wanted effect of my implementation
0 ·
Comments
Thank you for your contact.
This is Live2D Support.
Please check CubismRenderer_OpenGLES2.cpp in CubismSdkForNative Framework.
It defines a fragment shader around which the FragShaderSrc variable is defined.
Please follow that description and add a shader with color and effect processing.
After adding the shaders, load them with the CubismShader_OpenGLES2::GenerateShaders function.
Please replace the items that set the shaders for each application in the CubismShader_OpenGLES2::SetupShaderProgram function.
hope that helps!
How do I add a new shader only for specific model/s in the app?
(please excuse me I am new to the subject of Opengl es).
As a prerequisite, the shaders are designed to be the same for all models.
If you want to set a different shader for a specific model, you need to get the CubismModel using the CubismShader_OpenGLES2::SetupShaderProgram function.
Please use the model information to identify your model and switch the shader to be set.
hope that helps!
I now face a different problem I try to add phong light to the shader but I don't understand how to calculate the normals for the model vertex positions
can you explain the line in the SetupShaderProgram() method:
glVertexAttribPointer(shaderSet->AttributePositionLocation, 2, GL_FLOAT, GL_FALSE, sizeof(csmFloat32) * 2, vertexArray);
from what I think the vertexArray hold vec2 positions with stride Length of 2.
if so what is stored in the other positions of the vertexArray?
glVertexAttribPointer() is a method provided by OpenGL, so please refer to the official OpenGL documentation.
The arguments are as follows.
shaderSet->AttributePositionLocation is the index of the shader
vertexArray is the model's vertex array obtained using csmGetDrawableVertexPositions().
hope that helps!