Skip to content

Commit

Permalink
resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenxiZhou0619 committed Oct 26, 2023
2 parents 03a010d + 68c0c48 commit ed5f006
Show file tree
Hide file tree
Showing 39 changed files with 1,663 additions and 273 deletions.
Binary file added scenes/curly-hair/models/wCurly.fiber
Binary file not shown.
80 changes: 80 additions & 0 deletions scenes/curly-hair/scene.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"mediums": [],
"materials": [
{
"name": "hair",
"albedo": 1,
"type": "hair",
"scale_angle": 2.5,
"melanin_ratio": 1,
"melanin_concentration": 1.3,
"roughness": 0.3
}
],
"entities": [
{
"transform":[0,0,0.1,0,0.13,0,0,0,0,0.1,0,0,0,9.4,0,1],
"type": "curves",
"file": "models/wCurly.fiber",
"curve_thickness": 0.05,
"curve_taper": false,
"subsample": 0,
"material": "hair",
"width_scale" : 0.111
},{
"cap_dir": [0.19,0.75,-0.62],
"power": 20,
"type": "infinite_sphere_cap",
"sample": true,
"cap_angle": 10
}

],
"camera": {
"tonemap": "filmic",
"resolution": 1024,
"reconstruction_filter": "tent",
"transform": {
"position": [
-0.234672,
16.5124,
-25.3482
],
"look_at": [
0.134185,
9.92412,
-0.828005
],
"up": [
0,
1,
0
]
},
"type": "pinhole",
"fov": 35
},
"integrator": {
"min_bounces": 1,
"max_bounces": 64,
"enable_consistency_checks": false,
"enable_two_sided_shading": true,
"type": "path_tracer",
"enable_light_sampling": true,
"enable_volume_light_sampling": true
},
"renderer": {
"output_file": "curly-hair",
"resume_render_prefix": "TungstenRenderState",
"overwrite_output_files": false,
"adaptive_sampling": true,
"enable_resume_render": false,
"stratified_sampler": true,
"scene_bvh": true,
"spp": 1,
"spp_step": 16,
"checkpoint_interval": "0",
"timeout": "0",
"hdr_output_file": "curly-hair.exr"
}
}
100 changes: 78 additions & 22 deletions scenes/green-bathroom/scene.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"renderer": {
"spp": 4096,
"spp": 4,
"output_file": "green_bathroom"
},

"mediums": [],

"materials": [
{
"name": "bamboo",
Expand All @@ -26,14 +24,22 @@
{
"name": "ceramics",
"type": "plastic",
"albedo": [0.9, 0.9, 0.9],
"albedo": [
0.9,
0.9,
0.9
],
"roughness": 0.015,
"ior": 1.45
},
{
"name": "czarne",
"type": "plastic",
"albedo": [0.1, 0.1, 0.1],
"albedo": [
0.1,
0.1,
0.1
],
"roughness": 0.01,
"ior": 1.7
},
Expand All @@ -42,24 +48,40 @@
"type": "conductor",
"distribution": "ggx",
"material": "Al",
"albedo": [0.8, 0.8, 0.8],
"albedo": [
0.8,
0.8,
0.8
],
"roughness": 0.3
},
{
"name": "Material.005",
"type": "lambert",
"albedo": [0.8, 0.8, 0.8]
"albedo": [
0.8,
0.8,
0.8
]
},
{
"name": "czerwony",
"type": "conductor",
"albedo": [1, 0.042, 0],
"albedo": [
1,
0.042,
0
],
"roughness": 0.02
},
{
"name": "Material.004",
"type": "lambert",
"albedo": [0.8, 0.779, 0.687]
"albedo": [
0.8,
0.779,
0.687
]
},
{
"name": "Material.009",
Expand All @@ -74,7 +96,11 @@
{
"name": "Material.013",
"type": "lambert",
"albedo": [1, 1, 1]
"albedo": [
1,
1,
1
]
},
{
"name": "szare plytki",
Expand All @@ -86,19 +112,31 @@
{
"name": "biale sciany",
"type": "lambert",
"albedo": [1, 1, 1]
"albedo": [
1,
1,
1
]
},
{
"name": "zielony",
"type": "plastic",
"albedo": [0.364, 0.8, 0.110],
"albedo": [
0.364,
0.8,
0.110
],
"roughness": 0.02,
"ior": 1.5
},
{
"name": "bialy.001",
"type": "plastic",
"albedo": [0.8, 0.8, 0.8],
"albedo": [
0.8,
0.8,
0.8
],
"roughness": 0.01,
"ior": 1.3
},
Expand Down Expand Up @@ -129,7 +167,11 @@
{
"name": "Material.008",
"type": "lambert",
"albedo": [0.8, 0.8, 0.8]
"albedo": [
0.8,
0.8,
0.8
]
},
{
"name": "Material.017",
Expand All @@ -154,8 +196,16 @@
"distribution": "ggx",
"roughness": 0.001,
"ior": 1.45,
"albedo_reflection": [1, 0.717, 0.194],
"albedo_transmission": [1, 0.717, 0.194]
"albedo_reflection": [
1,
0.717,
0.194
],
"albedo_transmission": [
1,
0.717,
0.194
]
},
{
"name": "n5",
Expand All @@ -165,13 +215,16 @@
{
"name": "White-pot",
"type": "disney",
"albedo": [0.8, 0.8, 0.8],
"albedo": [
0.8,
0.8,
0.8
],
"metallic": 0,
"specular": 0.5,
"roughness": 0.5
}
],

"entities": [
{
"type": "mesh",
Expand Down Expand Up @@ -439,7 +492,9 @@
"material": "Material.014",
"transform": {
"rotation": [
0, 0, 0
0,
0,
0
]
}
},
Expand Down Expand Up @@ -538,10 +593,11 @@
"emission": "textures/envmap.hdr"
}
],

"camera": {
"type": "pinhole",
"type": "thinlens",
"fov": 50,
"aperture_radius": 0.1,
"focus_distance": 10,
"resolution": [
1400,
900
Expand All @@ -564,4 +620,4 @@
]
}
}
}
}
81 changes: 81 additions & 0 deletions src/CoreLayer/Geometry/BoundingBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,84 @@ static BoundingBox3<BaseType> BoundingBoxPointUnion(const BoundingBox3<BaseType>
}

using BoundingBox3f = BoundingBox3<double>;

//Axis-aligned bounding box 2D base type
template <typename BaseType>
class BoundingBox2
{
public:
TPoint2<BaseType> pMin;
TPoint2<BaseType> pMax;

BoundingBox2(){
pMin[0] = pMin[1] = std::numeric_limits<BaseType>::max();
pMax[0] = pMax[1] = std::numeric_limits<BaseType>::lowest();
}

BoundingBox2(TPoint2<BaseType> _p)
{
pMin = pMax = _p;
}

BoundingBox2(TPoint2<BaseType> _pMin, TPoint2<BaseType> _pMax)
{
pMin = _pMin;
pMax = _pMax;

// corner case: bounding box not exist
if(pMin.x > pMax.x || pMin.y > pMax.y){
pMin[0] = pMin[1] = std::numeric_limits<BaseType>::max();
pMax[0] = pMax[1] = std::numeric_limits<BaseType>::lowest();
}
}

// caculate area
inline double getSurfaceArea(){
double x = pMax[0] - pMin[0];
double y = pMax[1] - pMin[1];

return x * y;
}

// judge if overlap
inline bool overlap(BoundingBox2 &box){
if(pMin[0] > box.pMax[0] || pMax[0] < box.pMin[0])
return false;
if(pMin[1] > box.pMax[1] || pMax[1] < box.pMin[1])
return false;
return true;
}

// judge if contains some box
inline bool contains(BoundingBox2 &box){
if(pMin[0] > box.pMin[0] || pMax[0] < box.pMax[0])
return false;
if(pMin[1] > box.pMin[1] || pMax[1] < box.pMax[1])
return false;
return true;
}

inline TPoint2<BaseType> getCenter(){
return TPoint2<BaseType>((pMin[0] + pMax[0]) / 2, (pMin[1] + pMax[1]) / 2);
}
};

template <typename BaseType>
static BoundingBox2<BaseType> BoundingBoxUnionIntersect(const BoundingBox2<BaseType>& b1,
const BoundingBox2<BaseType>& b2)
{
TPoint2<BaseType> _pMin(std::max(b1.pMin[0], b2.pMin[0]), std::max(b1.pMin[1], b2.pMin[1]));
TPoint2<BaseType> _pMax(std::min(b1.pMax[0], b2.pMax[0]), std::min(b1.pMax[1], b2.pMax[1]));
return BoundingBox2(_pMin, _pMax);
}

template <typename BaseType>
static BoundingBox2<BaseType> BoundingBoxPointUnion(const BoundingBox2<BaseType>& b1,
const TPoint2<BaseType>& p)
{
TPoint2<BaseType> _pMin(std::min(b1.pMin[0], p[0]), std::min(b1.pMin[1], p[1]));
TPoint2<BaseType> _pMax(std::max(b1.pMax[0], p[0]), std::max(b1.pMax[1], p[1]));
return BoundingBox2(_pMin, _pMax);
}

using BoundingBox2d = BoundingBox2<double>;
Loading

0 comments on commit ed5f006

Please sign in to comment.