Skip to content

Commit

Permalink
Update content
Browse files Browse the repository at this point in the history
  • Loading branch information
devendrn committed Jan 5, 2024
1 parent 23a91ef commit 9afd98d
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 40 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

An unofficial documentation webpage about RenderDragon shaders, built using Vitepress.

This webpage builds upon **[Render-dragon-shader-list](https://github.com/DominoKorean/Render-dragon-shader-list)**, addressing some of its drawbacks in displaying contents efficiently for an average user. It also extends by providing documentation and resources on making custom shaders for RenderDragon. **The webpage is however not complete yet.**
This webpage builds upon **[Render-dragon-shader-list](https://github.com/DominoKorean/Render-dragon-shader-list)**, addressing some of its drawbacks in displaying contents efficiently for an average user.
It also extends by providing documentation and resources on making custom shaders for RenderDragon.
**The webpage is however not complete yet.**

## Progress

Expand Down Expand Up @@ -60,7 +62,8 @@ npm run docs:dev

### 1. Write docs

You can add new sections in documentation to cover resources that you think might help others. If you want to create a new page for the same, create a new .md file in `docs/docs/` and link this to the documentation sidebar in `en.ts`
You can add new sections in documentation to cover resources that you think might help others.
If you want to create a new page for the same, create a new .md file in `docs/docs/` and link this to the documentation sidebar in `en.ts`

### 3. Improve or update content

Expand Down Expand Up @@ -113,8 +116,12 @@ You can help in improving the documentation by fixing typos, rectifying incorrec

## Feedbacks

Feedbacks and suggestions are also welcome! You could suggest how to improve the layout of displayed content, like adding certain changes in shader banner cards. Maybe you have a better logo for this website in hand. Whatever it may be, we'd love to hear your thoughts and keep improving this webpage.
Feedbacks and suggestions are also welcome!
You could suggest how to improve the layout of displayed content, like adding certain changes in shader banner cards.
Maybe you have a better logo for this website in hand.
Whatever it may be, we'd love to hear your thoughts and keep improving this webpage.

## Note

This webpage/repository has no affiliation with Mojang Studios or Minecraft. **RenderDragon and its assets are solely owned by Mojang Studios.**
This webpage/repository has no affiliation with Mojang Studios or Minecraft.
**RenderDragon and its assets are solely owned by Mojang Studios.**
63 changes: 42 additions & 21 deletions docs/docs/build.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
# Building shaders

ddf8186's [MaterialBinTool](https://github.com/ddf8196/MaterialBinTool) along with shaderc are the main utilities that let you create custom shaders for RenderDragon. This page will show you how to setup, build, and test your custom shader files. You will be using a template repository with all the necessary scripts and code to get started.
ddf8196's [MaterialBinTool](https://github.com/ddf8196/MaterialBinTool) along with shaderc are the main utilities that let you create custom shaders for RenderDragon.
This page will show you how to setup, build, and test your custom shader files.
You will be using a template repository with all the necessary scripts and code to get started.

::: danger Danger

This is an unofficial way to make custom shaders. There may also be mistakes or incorrect information in this guide. If you find one, please open an issue [here](https://github.com/devendrn/renderdragon-shaders) or make a PR.
This is an unofficial way to make custom shaders.
There may also be mistakes or incorrect information in this guide.
If you find one, please open an issue [here](https://github.com/devendrn/renderdragon-shaders) or make a PR.

:::

## Setup workspace

1. Download the unofficial shader template source from this repository: [RenderDragonSourceInv](https://github.com/SurvivalApparatusCommunication/RenderDragonSourceCodeInv)
1. Download the unofficial shader template source from this repository:
[RenderDragonSourceInv](https://github.com/SurvivalApparatusCommunication/RenderDragonSourceCodeInv)

2. Run `setup_build_environment.bat`. This will download MaterialBinTool, shaderc, and material json files necessary for compiling shader files.
2. Run `setup_build_environment.bat`.
This will download MaterialBinTool, shaderc, and material json files necessary for compiling shader files.

## About the source code

The shader source code uses bgfx's cross-platform shader language which is based on GLSL. Bgfx shader files are compiled using shaderc. You can learn about it from [here](https://bkaradzic.github.io/bgfx/tools.html#shader-compiler-shaderc).
The shader source code uses bgfx's cross-platform shader language which is based on GLSL.
Bgfx shader files are compiled using shaderc.
You can learn about it from [here](https://bkaradzic.github.io/bgfx/tools.html#shader-compiler-shaderc).

The source files in this repo are organized in the following manner:
```
Expand All @@ -29,9 +37,12 @@ materials
. └─ RenderChunk.varying.sc
```

The `materials` directory already includes the inverse source code of most shader files that you'd probably need. You can delete the source files that you don't use. If you want to get the inverse source code of a material that is not here, you can [check this](https://github.com/Veka0/mcbe-shader-codebase).
The `materials` directory already includes the inverse source code of most shader files that you'd probably need.
You can delete the source files that you don't use.
If you want to get the inverse source code of a material that is not here, you can [check this](https://github.com/Veka0/mcbe-shader-codebase).

`defines.json` is where you can add macro definition rules to flags that have more than just On and Off values. You can find the available flags and values for material from its corresponding material.json file in the `data` directory.
`defines.json` is where you can add macro definition rules to flags that have more than just On and Off values.
You can find the available flags and values for material from its corresponding material.json file in the `data` directory.

```json
// defines.json
Expand All @@ -48,7 +59,8 @@ The `materials` directory already includes the inverse source code of most shade

## Building materials

You can build shader material files using `build.bat`. The build script accepts the following arguments:
You can build shader material files using `build.bat`.
The build script accepts the following arguments:

```
-p Target platforms. The default is to build for all platforms.
Expand All @@ -59,45 +71,54 @@ You can build shader material files using `build.bat`. The build script accepts
To build all shader materials, run:

```shell
build.bat
./build.bat
```

To build specific materials only, run:
```shell
build.bat -m RenderChunk Sky
./build.bat -m RenderChunk Sky
```

To build files for a specific platform, run:
```shell
build.bat -m RenderChunk Sky -p Android
./build.bat -m RenderChunk Sky -p Android
```
Supported platforms: `Android Windows iOS`

Optionally if you want to merge multiple platform material files into a single material file, you can take a look at this.
Optionally if you want to merge multiple platform material files into a single material file, you can take a look at [this](extra#merged-data).

## Installing materials

The installation method depends on your platform. To save time, you should automate this process using a simple copy-paste script.
The installation method depends on your platform.
To save time, you should automate this process using a simple copy-paste script.

* [See installation guide](../shaders/installation/start.md)
* [See installation guide](../shaders/installation/start)

To see edited changes in the game, you have to leave and rejoin the world. If you have edited the LegacyCubemap, then you have to reload the entire game, because LegacyCubemap is also being used in the start menu.
To see edited changes in the game, you have to leave and rejoin the world.
If you have edited the LegacyCubemap, then you have to reload the entire game, because LegacyCubemap is also being used in the start menu.

## Debugging shader with RenderDoc
## Debugging shader

You can use free graphics debugging tools like [RenderDoc](https://renderdoc.org/) for debugging your shader.
You can use free graphics debugging tools like Pix, RenderDoc for debugging your shader.

### Windows
### Using Pix on Windows:

* Launch the Minecraft from RenderDoc
Here's a link to download PIX, you can figure out the rest yourself.
[Download PIX](https://devblogs.microsoft.com/pix/download/)

### Linux:

### Using RenderDoc on Linux:

[RenderDoc](https://renderdoc.org/) is a free stand-alone graphics debugger that allows quick and easy single-frame capture and detailed introspection of any application using Vulkan, D3D11, OpenGL & OpenGL ES or D3D12 across Windows, Linux, or Android.

#### Steps:
* File > Launch application
* Add path to your `mcpelauncher-ui-qt` executable
* Enable "Capture Child Processes" in capture options
* Launch it and enter the game
* File > Attach to running instance
* Select `mcpelauncher-client` instance

In order to debug the shader, you have to capture a frame. You can press `PrtScrn` or `F12` to start capture. You can then load the capture to inspect its contents.
In order to debug the shader, you have to capture a frame.
You can press `PrtScrn` or `F12` to start capture.
You can then load the capture to inspect its contents.
48 changes: 47 additions & 1 deletion docs/docs/extra.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,50 @@
# Extra resources

This page will include random things which might be useful to a small niche of users.
This page will include random things that might be useful to a small niche of users.


## Unpacking data from material.bin files

```sh
java -jar MaterialBinTool-all.jar -u "material.bin files to unpack"
```

You can find material.bin files inside `<minecraft data path>/assets/renderer/materials`


## Merged material files using MBT {#merged-data}

Material data from multiple platforms can be merged into a single data file and then be used to compile materials that will work on all platforms that were included in the merge.
Keep in mind that the final material.bin file will be quite large.

To merge material data using the MBT jar, run:
```sh
java -jar ./MaterialBinTool-all.jar --data-only -o "output dir" -m "material.json files of each platform"
```

This will only work if the material.json files are all from the same version of MC.

Here is a bash script to do multiple files in the following structure:
```
Android
└─ RenderChunk
└─ RenderChunk.json
Windows
└─ RenderChunk
└─ RenderChunk.json
iOS
└─ RenderChunk
└─ RenderChunk.json
```
```sh
#!/bin/bash
MBT="java -jar ./MaterialBinTool-0.8.2-all.jar"
MATERIALS="Android/*"
for s in $MATERIALS; do
MAT=$(basename ${s})
echo "Merging $MAT"
$MBT --data-only -o merged/$MAT/ -m Android/$MAT/$MAT.json Windows/$MAT/$MAT.json iOS/$MAT/$MAT.json
done
```

To use these, copy the `Merged/` directory to `data/`, and add the argument `-p Merged` when building.
19 changes: 13 additions & 6 deletions docs/docs/start.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
::: warning Warning

There may be mistakes or incorrect information in this guide. If you find one, please open an issue [here](https://github.com/devendrn/renderdragon-shaders) or make a PR.
There may be mistakes or incorrect information in this guide.
If you find one, please open an issue [here](https://github.com/devendrn/renderdragon-shaders) or make a PR.

:::

# What is RenderDragon?

RenderDragon is a new cross-platform rendering engine for Minecraft Bedrock, initially announced in 2019. It includes several changes under the hood to improve the performance and graphics capabilities of Minecraft [[1]](https://www.minecraft.net/en-us/article/render-dragon-and-nvidia-ray-tracing). One of its major features is support for real-time raytraced graphics on compatible RTX graphics cards.
RenderDragon is a new cross-platform rendering engine for Minecraft Bedrock, initially announced in 2019.
It includes several changes under the hood to improve the performance and graphics capabilities of Minecraft [[1]](https://www.minecraft.net/en-us/article/render-dragon-and-nvidia-ray-tracing). One of its major features is support for real-time raytraced graphics on compatible RTX graphics cards.

RenderDragon is constantly improving with every update, adding new improvements and capabilities. [Deferred Rendering Pipeline](deferred) is a new major feature of RenderDragon that is currently being worked on by Minecraft. It is expected to bring a major graphics overhaul with dynamic shadows, PBR materials, bloom, tone mapping, and other features to a wide range of platforms. [[2]](https://www.minecraft.net/en-us/creator/article/new-render-dragon-features-creators)
RenderDragon is constantly improving with every update, adding new improvements and capabilities.
[Deferred Rendering Pipeline](deferred) is a new major feature of RenderDragon that is currently being worked on by Minecraft.
It is expected to bring a major graphics overhaul with dynamic shadows, PBR materials, bloom, tone mapping, and other features to a wide range of platforms. [[2]](https://www.minecraft.net/en-us/creator/article/new-render-dragon-features-creators)

<br>

_ _ _

# Getting started

As of now, Minecraft Bedrock does not officially support custom shaders. It was removed with the addition of RenderDragon on Bedrock. This documentation covers an unofficial way by which you can make and use custom shaders on RenderDragon.
As of now, Minecraft Bedrock does not officially support custom shaders.
It was removed with the addition of RenderDragon on Bedrock.
This documentation covers an unofficial way by which you can make and use custom shaders on RenderDragon.

If you, like us, also want Minecraft Bedrock to support custom shaders officially, then go ahead and upvote this [feedback post](https://feedback.minecraft.net/hc/en-us/community/posts/360077420452-3rd-party-shader-support-for-render-dragon).


You can make and use custom shaders on RenderDragon thanks to the efforts of [ddf8186](https://github.com/ddf8196), who managed to create some utilities for building shaders and loading them. The following guide will cover how you can use his tools and utilities for building shaders for RenderDragon.
You can make and use custom shaders on RenderDragon thanks to the efforts of [ddf8196](https://github.com/ddf8196), who managed to create some utilities for building shaders and loading them.
The following guide will cover how you can use his tools and utilities for building shaders.

### [🡪 How to build shaders](build)
### [🡪 Utilities](build)
### [🡪 Utilities](utilities)
15 changes: 10 additions & 5 deletions docs/docs/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ This page will cover a list of utilities relevant to this documentation.

## MaterialBinTool

[MaterialBinTool](https://github.com/ddf8196/MaterialBinTool) is a tool for packing/unpacking material.bin files. It also lets you compile material.bin files from source and material.json with the help of shaderc.
[MaterialBinTool](https://github.com/ddf8196/MaterialBinTool) is a tool for packing/unpacking material.bin files.
It also lets you compile material.bin files from source and material.json with the help of shaderc.


## bgfx-mcbe

[bgfx-mcbe](https://github.com/ddf8196/bgfx-mcbe) is a fork of bgfx, with some changes to support building shaders for RenderDragon. The shaderc used by MaterialBinTool is compiled from this repository.
[bgfx-mcbe](https://github.com/ddf8196/bgfx-mcbe) is a fork of bgfx, with some changes to support building shaders for RenderDragon.
The shaderc used by MaterialBinTool is compiled from this repository.


## mcbe-shader-codebase

[mcbe-shader-codebase](https://github.com/Veka0/mcbe-shader-codebase) is a repository containing the latest auto-generated vanilla inverse source files. The generated code is usually accurate, but may sometimes require an edit before it can be actually compiled.
[mcbe-shader-codebase](https://github.com/Veka0/mcbe-shader-codebase) is a repository containing the latest auto-generated vanilla inverse source files.
The generated code is usually accurate, but may sometimes require an edit before it can be actually compiled.


## RenderDragonData
Expand All @@ -25,12 +28,14 @@ This page will cover a list of utilities relevant to this documentation.

## BetterRenderDragon

[BetterRenderDragon](https://github.com/ddf8196/BetterRenderDragon) is an enhancement mod for the RenderDragon engine of Minecraft Bedrock (Windows). It lets you enable deferred rendering, disable ray tracing, and load RenderDragon shaders from resource packs.
[BetterRenderDragon](https://github.com/ddf8196/BetterRenderDragon) is an enhancement mod for the RenderDragon engine of Minecraft Bedrock (Windows).
It lets you enable deferred rendering, disable ray tracing, and load RenderDragon shaders from resource packs.


## MaterialBinLoader

[MaterialBinLoader](https://github.com/ddf8196/MaterialBinLoader) is a mod for Minecraft apk that makes the game load material.bin files from the resource pack. The patched apk includes this mod.
[MaterialBinLoader](https://github.com/ddf8196/MaterialBinLoader) is a mod for Minecraft apk that makes the game load material.bin files from the resource pack.
The patched apk includes this mod.


## mcpelauncher-shadersmod
Expand Down
3 changes: 2 additions & 1 deletion docs/shaders/installation/ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

::: danger Not recommended

Unlike other platforms, installing shaders on iOS is very tricky. Please don't follow this guide if you don't understand what you are doing!
Unlike other platforms, installing shaders on iOS is very tricky.
Please don't follow this guide if you don't understand what you are doing!

:::

Expand Down
7 changes: 5 additions & 2 deletions docs/shaders/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# RenderDragon Shaders

::: danger Incomplete Documentation!
This documentation website is still in its early stages of development! Please don't rely on any content provided here.
This documentation website is still in its early stages of development!
Please don't rely on any content provided here.
:::

Minecraft Bedrock does not officially support loading third-party RenderDragon shaders.
Expand All @@ -15,5 +16,7 @@ A curated list of shaders for RenderDragon.

## Deferred Pipeline Shaders

A curated list of shaders for the deferred pipeline of RenderDragon. To use these shaders, you must be on the latest Minecraft (beta).
A curated list of shaders for the deferred pipeline of RenderDragon.
To use these shaders, you must be on the latest Minecraft (beta).

### [🡪 Explore deferred shaders](list/deferred)

0 comments on commit 9afd98d

Please sign in to comment.