improve material demo

main
Dominik Madarász 2024-03-20 20:46:40 +01:00
parent 91d3f9a03a
commit 7efc59079a
13 changed files with 35 additions and 6 deletions

View File

@ -5,6 +5,15 @@
#include "v4k.h"
const char *skyboxes[][2] = { // reflection, env, metadata
{"hdr/Tokyo_BigSight_1k.hdr","hdr/Tokyo_BigSight_Env.hdr"},
{"hdr/GCanyon_C_YumaPoint_1k.hdr","hdr/GCanyon_C_YumaPoint_Env.hdr"},
{"hdr/Factory_Catwalk_1k.hdr","hdr/Factory_Catwalk_Env.hdr"},
{"hdr/MonValley_G_DirtRoad_1k.hdr","hdr/MonValley_G_DirtRoad_Env.hdr"},
{"hdr/Shiodome_Stairs_1k.hdr","hdr/Shiodome_Stairs_Env.hdr"},
};
int main() {
// create the window
window_create( 0.75f, WINDOW_MSAA8 );
@ -24,7 +33,9 @@ int main() {
// load model
model_t m1 = model("suzanne.obj", MODEL_NO_ANIMATIONS);
model_t m2 = model("suzanne.obj", MODEL_NO_ANIMATIONS|MODEL_MATCAPS);
model_t m3 = model("damagedhelmet.gltf", MODEL_NO_ANIMATIONS|MODEL_PBR);
// model_t m3 = model("damagedhelmet.gltf", MODEL_NO_ANIMATIONS|MODEL_PBR);
model_t m3 = model("Scutum_low.fbx", MODEL_NO_ANIMATIONS|MODEL_PBR);
// model_t m3 = model("Cerberus_LP.FBX", MODEL_NO_ANIMATIONS|MODEL_PBR);
// spawn object1 (diffuse)
object_t* obj1 = scene_spawn();
@ -55,7 +66,7 @@ int main() {
object_model(obj4, m3);
object_scale(obj4, vec3(3,3,3));
object_move(obj4, vec3(-10+6*3,0,-10));
object_pivot(obj4, vec3(0,90,0));
object_pivot(obj4, vec3(0,0,90));
// create point light
light_t* l = scene_spawn_light();
@ -88,5 +99,22 @@ int main() {
camera_moveby(&cam, wasdec);
camera_fps(&cam, mouselook.x,mouselook.y);
window_cursor( !active );
if (ui_panel("FXs", 0)) {
ui_fxs();
ui_panel_end();
}
if( ui_panel( "Viewer", 0 ) ) {
for( int i = 0; i < countof(skyboxes); i++ ) {
const char *filename = skyboxes[i][0];
// bool selected = !strcmp(g_skybox.reflection->filename, file_name(filename));
bool selected = false;
if( ui_bool( filename, &selected ) ) {
scene_get_active()->skybox = skybox_pbr(skyboxes[i][0], skyboxes[i][1]);
}
}
ui_panel_end();
}
}
}

Binary file not shown.

View File

@ -0,0 +1 @@
frame: 0-0 Idle

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 MiB

View File

@ -688,7 +688,7 @@ void main(void)
// float dither = random( uvec3( floatBitsToUint( gl_FragCoord.xy ), frame_count ) );
// color += BOOST_NOISE * vec3( (-1.0/256.) + (2./256.) * dither );
#if 1 // original
#if 0 // original
// basic tonemap and gamma correction
color = color / ( vec3(1.) + color );
color = pow( color, vec3(1. / 2.2) );

View File

@ -372652,7 +372652,7 @@ bool pbr_material(pbr_material_t *pbr, const char *material) {
array(char*) tokens = strsplit(material, "+");
for( int j = 0, end = array_count(tokens); j < end; ++j ) {
char *t = tokens[j];
if( strstri(t, "_D.") || strstri(t, "Diffuse") || strstri(t, "BaseColor") ) colormap(&pbr->diffuse, t, 1);
if( strstri(t, "_D.") || strstri(t, "Diffuse") || strstri(t, "BaseColor") || strstri(t, "Base_Color") ) colormap(&pbr->diffuse, t, 1);
if( strstri(t, "_N.") || strstri(t, "Normal") ) colormap(&pbr->normals, t, 0);
if( strstri(t, "_S.") || strstri(t, "Specular") ) colormap(&pbr->specular, t, 0);
if( strstri(t, "_A.") || strstri(t, "Albedo") ) colormap(&pbr->albedo, t, 1); // 0?

View File

@ -2624,7 +2624,7 @@ bool pbr_material(pbr_material_t *pbr, const char *material) {
array(char*) tokens = strsplit(material, "+");
for( int j = 0, end = array_count(tokens); j < end; ++j ) {
char *t = tokens[j];
if( strstri(t, "_D.") || strstri(t, "Diffuse") || strstri(t, "BaseColor") ) colormap(&pbr->diffuse, t, 1);
if( strstri(t, "_D.") || strstri(t, "Diffuse") || strstri(t, "BaseColor") || strstri(t, "Base_Color") ) colormap(&pbr->diffuse, t, 1);
if( strstri(t, "_N.") || strstri(t, "Normal") ) colormap(&pbr->normals, t, 0);
if( strstri(t, "_S.") || strstri(t, "Specular") ) colormap(&pbr->specular, t, 0);
if( strstri(t, "_A.") || strstri(t, "Albedo") ) colormap(&pbr->albedo, t, 1); // 0?

View File

@ -19798,7 +19798,7 @@ bool pbr_material(pbr_material_t *pbr, const char *material) {
array(char*) tokens = strsplit(material, "+");
for( int j = 0, end = array_count(tokens); j < end; ++j ) {
char *t = tokens[j];
if( strstri(t, "_D.") || strstri(t, "Diffuse") || strstri(t, "BaseColor") ) colormap(&pbr->diffuse, t, 1);
if( strstri(t, "_D.") || strstri(t, "Diffuse") || strstri(t, "BaseColor") || strstri(t, "Base_Color") ) colormap(&pbr->diffuse, t, 1);
if( strstri(t, "_N.") || strstri(t, "Normal") ) colormap(&pbr->normals, t, 0);
if( strstri(t, "_S.") || strstri(t, "Specular") ) colormap(&pbr->specular, t, 0);
if( strstri(t, "_A.") || strstri(t, "Albedo") ) colormap(&pbr->albedo, t, 1); // 0?