-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from liuyun-0002/glint
feature: Add glint material
- Loading branch information
Showing
12 changed files
with
558 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include"DifferentialPinhole.h" | ||
|
||
Ray DifferentialPinholeCamera::generateRay(const Point2i &filmResolution, const Point2i &pixelPosition, const CameraSample &sample) const { | ||
double x = (double)(pixelPosition.x + sample.xy.x) / filmResolution.x, | ||
y = (double)(pixelPosition.y + sample.xy.y) / filmResolution.y; | ||
|
||
Point3d pointOnFilm = sampleToFilm * Point3d {x, y, 0}, | ||
origin = Point3d {0, 0, 0}; | ||
|
||
Vec3d dir = cameraToWorld * normalize(pointOnFilm - origin); | ||
Vec3d dirX = cameraToWorld * normalize((sampleToFilm * Point3d {x + 1.f, y, 0}) - origin); | ||
Vec3d dirY = cameraToWorld * normalize((sampleToFilm * Point3d {x, y + 1.f, 0}) - origin); | ||
|
||
origin = cameraToWorld * origin; | ||
|
||
Ray ret = Ray(origin, dir); | ||
|
||
ret.hasDifferential = true; | ||
ret.direction_x = dirX; | ||
ret.direction_y = dirY; | ||
ret.origin_x = ret.origin_y = origin; | ||
|
||
return ret; | ||
} | ||
|
||
DifferentialPinholeCamera::DifferentialPinholeCamera(const Json & json) : PerspectiveCamera(json) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include "Perspective.h" | ||
#include "CoreLayer/Adapter/JsonUtil.h" | ||
|
||
// pinhole with differential | ||
class DifferentialPinholeCamera : public PerspectiveCamera { | ||
public: | ||
DifferentialPinholeCamera() = default; | ||
DifferentialPinholeCamera( | ||
const Point3d &lookFrom, | ||
const Point3d &lookAt, | ||
const Vec3d &up, | ||
double xFov, | ||
double aspectRatio, | ||
double distToFilm | ||
) : PerspectiveCamera(lookFrom, lookAt, up, xFov, aspectRatio, distToFilm) { } | ||
|
||
DifferentialPinholeCamera(const Json & json); | ||
|
||
virtual Ray generateRay(const Point2i &filmResolution, | ||
const Point2i &pixelPosition, | ||
const CameraSample &sample) const override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.