How to Create MC3DS shaders
This repository has a decompiled in-game shader file of the minecraft 3ds shader.
- Go to the repository linked above
- Go to the homebrew folder, and pick a vertex shader file (.VSH) to edit (not all are converted to picasso yet, if a shader file you want to edit has not been converted, contact Pizzaleader)
- Download the file, it is recommended to create a new folder to store your shader related stuff
- Go to this link and install the graphical installer.
- When it asks you what components you want to install, get the 3ds dev component
- Search in the windows search “MSys2” Open it, then run “dkp-pacman -S picasso”. Or, If that did not work, extract this zip and put the folder called picasso in C:\devkitPro.
- Edit the .VSH files with notepad++ or a similar tool (Picasso manual)
- Copy your shader folder path and put it after CD in MSys2
- Use this command to build your shader:
picasso -o [].shbin [].vsh
(Replace the [] with the shader file name) - Put the .shbin file you get as a result in \romfs\3DS\shaders
For people with some knowledge of shaders
Vertex shaders are the only programmable shaders implemented by the CTR-SDK(PICA200). Vertex shaders are written in PICA-specific assembly language. The OpenGL ES 2.0 API loads the executable files and then runs the shaders. The OpenGL ES 2.0 API can load only executable files that have been assembled and linked. You can't load shader files written in GLSL.
Vertex shaders are run from the main function. A main object is an object file that can be assembled from an assembly code file that has a main function. A reference object is an object file that can be assembled from an assembly code file that does not have a main function.
To put a main function in an assembly code file, set the main label at the location where shader execution starts and set the endmain label after the last instruction at the end of the main function. (This is the last instruction in the main function, not the last instruction in the assembly code file.) A reference object only has subroutines and is referenced by a main object to resolve unresolved labels. When the objects are linked to create an executable file, the executable file does not include reference objects that are not referenced by any main objects
Input Registers
Input registers are floating-point registers that store vertex attribute data ("attributes" in OpenGL ES 2.0 applications).
Temporary Registers
Temporary registers are floating-point registers that temporarily maintain calculation results to be reused later. Their values are preserved until they are overwritten.
Floating-Point Constant Registers
Floating-point constant registers are floating-point registers that store constants to use for calculations. Uniforms for OpenGL ES 2.0 applications are stored here.
Output Registers
These registers output data that has been processed by vertex shaders into a later stage of the graphics pipeline.
Building
You can use the nintendo 3ds devkit or picasso from devkitpro. If you decide to use picasso as assembler, make sure use the file and instructions in homebrew folder.
Credits:
Endermanyk
Pizzaleader