Skip to content

Commit

Permalink
Merge pull request #254 from jebbyk/newPBR
Browse files Browse the repository at this point in the history
New pbr
  • Loading branch information
jebbyk committed Jan 16, 2022
2 parents 1ff14cf + 01804fe commit 06f5af9
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 143 deletions.
8 changes: 4 additions & 4 deletions .github/docs/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@
| |0.13.2 | Bugfixes |<span style="color:green">Ready</span>
|━━━━━━━━━━━━━ |━━━━━━ |━━━━━━━━━━━━━━━━ |━━━━━━━━|
|Parallax mapping |0.14.0 | Simple parallax mapping |<span style="color:green">Ready</span>
| |0.14.1 | Point light direction detection |<span style="color:green">**In progress**</span>|
| |0.14.2 | Bugfixes |<span style="color:orange">**Planned**</span>|
| |0.14.1 | Point light direction detection |<span style="color:red">Skipped</span>|
| |0.14.2 | Bugfixes |<span style="color:red">Skipped</span>|
|━━━━━━━━━━━━━ |━━━━━━ |━━━━━━━━━━━━━━━━ |━━━━━━━━|
|Compatibility improvement |0.15.0 | compatibility improvements |<span style="color:orange">**Planned**</span>|
| |0.15.1 | peresets system improvements |<span style="color:orange">**Planned**</span>|
|Compatibility improvement |0.15.0 | compatibility improvements |<span style="color:green">Ready</span>
| |0.15.1 | peresets system improvements |<span style="color:green">**In progress**</span>|
| |0.15.2 | Bugfixes |<span style="color:orange">**Planned**</span>|
|━━━━━━━━━━━━━ |━━━━━━ |━━━━━━━━━━━━━━━━ |━━━━━━━━|
|Improved reflections |0.16.0 | Fake terrain reflections |<span style="color:orange">**Planned**</span>|
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"description": "Open Source Bedrock Edition Shader",
"name": "OSBES",
"uuid": "67010235-00f4-0484-8b1d-80b110011997",
"version": [0, 14, 0]
"version": [0, 15, 0]
},
"modules": [
{
"description": "Open Source Bedrock Edition Shader",
"type": "resources",
"uuid": "53644fac-a276-42e5-843f-a3c6f169a9cd",
"version": [0, 14, 0]
"version": [0, 15, 0]
}
],
"metadata": {
Expand Down
Binary file modified pack_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 16 additions & 31 deletions shaders/glsl/color_texture.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -43,45 +43,30 @@ void main()



#ifdef EFFECTS_OFFSET
vec4 diffuse = vec4(0.0);
#ifdef EFFECTS_OFFSET

// Terrain attlass mostly is bigger than items attlass
// Tricky thing that do really needs refactoring (!) but it works currently and I dont wona touch it
#ifdef PBR_FEATURE_ENABLED
if(TEXTURE_DIMENSIONS.x == 32.0 * TEXTURE_ATLAS_DIMENSION.x){
vec2 uvhp = uv - fract(uv * TEXTURE_ATLAS_DIMENSION) / (TEXTURE_ATLAS_DIMENSION * 2.0);
diffuse = texture2D( TEXTURE_0, uvhp);
//vec4 diffuse = vec4(1.0, 0.0, 0.0, 1.0);
}else{
diffuse = texture2D(TEXTURE_0, uv);
}
#else
diffuse = texture2D(TEXTURE_0, uv);
#endif
vec4 diffuse = texture2D(TEXTURE_0, uv);
#else
vec4 diffuse = texture2D(TEXTURE_0, uv);
#endif

#else
#ifdef ALPHA_TEST // Inventory items (exclude UI buttons)
vec4 diffuse = vec4(0.0);
#else
#ifdef ALPHA_TEST // Inventory items (exclude UI buttons)

#ifdef PBR_FEATURE_ENABLED
// Terrain atlas mostly is bigger than items atlas
// This really needs refactoring (!), but it works currently and I dont wanna touch it
if(TEXTURE_DIMENSIONS.x == 32.0 * TEXTURE_ATLAS_DIMENSION.x){
vec2 uvhp = uv - fract(uv * TEXTURE_ATLAS_DIMENSION) / (TEXTURE_ATLAS_DIMENSION * 2.0);
diffuse = texture2D( TEXTURE_0, uvhp);
//vec4 diffuse = vec4(1.0, 0.0, 0.0, 1.0);
}else{
diffuse = texture2D(TEXTURE_0, uv);
}
vec4 diffuse = texture2D(TEXTURE_0, uv);
if(diffuse.a > 0.0 && diffuse.a < 12.0 / 256.0) { // alpha between 1.0 and 12.0 means current texture is pbr
diffuse.a = 1.0;
}
#else
diffuse = texture2D(TEXTURE_0, uv);
vec4 diffuse = texture2D(TEXTURE_0, uv);
#endif
//vec4 diffuse = vec4(1.0, 0.0, 0.0, 1.0);
#else // Only UI buttons
vec4 diffuse = texture2D(TEXTURE_0, uv);
#endif
#endif
#else // Only UI buttons
vec4 diffuse = texture2D(TEXTURE_0, uv);
#endif
#endif



Expand Down
36 changes: 18 additions & 18 deletions shaders/glsl/entity.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,28 @@ void main()
#ifndef NO_TEXTURE
#if !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE)

#ifdef USE_OVERLAY
// #ifdef USE_OVERLAY

#ifdef PBR_FEATURE_ENABLED
if(TEXTURE_DIMENSIONS.x > 1023.0){
highp vec2 uvhp = uv - fract(uv * TEXTURE_ATLAS_DIMENSION) / (TEXTURE_ATLAS_DIMENSION * 2.0);
color = texture2D( TEXTURE_0, uvhp);
}else{
color = texture2D(TEXTURE_0, uv);
}
#else
color = texture2D(TEXTURE_0, uv);
#endif
// #ifdef PBR_FEATURE_ENABLED
// if(TEXTURE_DIMENSIONS.x > 1023.0){
// highp vec2 uvhp = uv - fract(uv * TEXTURE_ATLAS_DIMENSION) / (TEXTURE_ATLAS_DIMENSION * 2.0);
// color = texture2D( TEXTURE_0, uvhp);
// }else{
// color = texture2D(TEXTURE_0, uv);
// }
// #else
// color = texture2D(TEXTURE_0, uv);
// #endif
// color = vec4(1.0,0.0,0.0,1.0);
#else // Apply only for blocks in hand
#ifdef PBR_FEATURE_ENABLED
highp vec2 uvhp = uv - fract(uv * TEXTURE_ATLAS_DIMENSION) / (TEXTURE_ATLAS_DIMENSION * 2.0);
color = texture2D( TEXTURE_0, uvhp);
#else
// #else // Apply only for blocks in hand
// #ifdef PBR_FEATURE_ENABLED
// highp vec2 uvhp = uv - fract(uv * TEXTURE_ATLAS_DIMENSION) / (TEXTURE_ATLAS_DIMENSION * 2.0);
// color = texture2D( TEXTURE_0, uvhp);
// #else
color = texture2D( TEXTURE_0, uv);
#endif
// #endif
// color = vec4(1.0, 0.0,0.0,1.0);
#endif
// #endif
#else
//color = texture2D_AA(TEXTURE_0, uv);
#endif //!defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE)
Expand Down
9 changes: 8 additions & 1 deletion shaders/glsl/includes/options/preset/atlas.glsl
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
#define TEXTURE_ATLAS_DIMENSION vec2(64.0, 32.0) // Number of rows and columns in texture atlas. Don't Change these values unless you know what you are doing
// this file is used to configure OSBES to properly read textures
#define TEXTURE_PADDING 1.0

#define WATER_NORMAL_MAP_RESOLUTION 16.0
#define WATER_NORMAL_OFFSET vec2(0.0, 0.0)

#define NOISE_MAP_RESOLUTION 16.0
#define NOISE_MAP_OFFSET vec2(16.0, 0.0)
3 changes: 2 additions & 1 deletion shaders/glsl/includes/options/preset/pbr.glsl
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
// #define PBR_FEATURE_ENABLED // comment this line if you are using simple (non pbr) texture pack
// this file is used to enable PBR texture mapping in OSBES
// #define PBR_FEATURE_ENABLED // comment this line if you are using simple (non pbr) texture pack
2 changes: 1 addition & 1 deletion shaders/glsl/includes/options/preset/surface.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define NORMAL_MAP_STRENGTH 1.0
#define PARALLAX_DEPTH 0.001
#define PARALLAX_DEPTH 2.0
#define WATER_NORMAL_MAP_STRENGTH 0.125
#define PUDDLES_AMOUNT 1.5
#define RAIN_MIN_WETNESS 0.5
Loading

0 comments on commit 06f5af9

Please sign in to comment.