Comments (7)
Hi @odil24
You'll need to provide the position, lookat and fov for the camera in the .scene file (.json isn't supported)
camera
{
position .276 .275 -.75
lookat .276 .275 .10
fov 40
}
You can have a look at one of the sample scene files: https://github.com/knightcrawler25/GLSL-PathTracer/blob/master/assets/cornell_box_orig.scene
from glsl-pathtracer.
camera { position .276 .275 -.75 lookat .276 .275 .10 fov 40 }
How it would be in Blender if Blender Camera rotation positions are:
X=90(eulers)
Y=0(EULERS)
Z=60(EULERS)????
Beacause, In Blender there are no has 0.0 like floated-rotation values, all are in Eulers.
from glsl-pathtracer.
If you're trying to get the camera parameters from Blender, you can run the following python script in the Blender text editor to get the position, lookat and fov in the console and copy-paste the values into the .scene file.
import bpy
from mathutils import Vector
from math import degrees
cam = bpy.context.scene.camera
m = cam.matrix_world
quat = m.to_quaternion()
pos = m.to_translation()
lookat = pos + quat @ Vector((0.0, 0.0, -1.0))
fov = degrees(cam.data.angle)
print( "position %f %f %f" % (pos.x, pos.z, -pos.y))
print( "lookat %f %f %f" % (lookat.x, lookat.z, -lookat.y))
print( "fov %f" % (fov))
One thing to note is that tilting the camera on the Y axis in blender wouldn't work as my code doesn't utilize the up vector for the camera.
from glsl-pathtracer.
If you're trying to get the camera parameters from Blender, you can run the following python script in the Blender text editor to get the position, lookat and fov in the console and copy-paste the values into the .scene file.
import bpy from mathutils import Vector from math import degrees cam = bpy.context.scene.camera m = cam.matrix_world quat = m.to_quaternion() pos = m.to_translation() lookat = pos + quat @ Vector((0.0, 0.0, -1.0)) fov = degrees(cam.data.angle) print( "position %f %f %f" % (pos.x, pos.z, -pos.y)) print( "lookat %f %f %f" % (lookat.x, lookat.z, -lookat.y)) print( "fov %f" % (fov))
One thing to note is that tilting the camera on the Y axis in blender wouldn't work as my code doesn't utilize the up vector for the camera.
I have done as you said but my camera is not ported as in Blender. Any solution?
from glsl-pathtracer.
Blender has a Z-up coordinate system whereas this project uses Y-up. Along with the camera, objects you export from blender should be exported with Y-up. Otherwise, the camera orientation from the script and the objects won't line up.
from glsl-pathtracer.
Blender has a Z-up coordinate system whereas this project uses Y-up. Along with the camera, objects you export from blender should be exported with Y-up. Otherwise, the camera orientation from the script and the objects won't line up.
It doesnt help me or I have done something wrong
from glsl-pathtracer.
It's difficult to tell what could be going wrong without looking at how the scene is setup in blender. Would you be able to share a sample .blend file?
from glsl-pathtracer.
Related Issues (20)
- Adding support for MacOS build
- Reading materials for the shader pipeline in the code HOT 1
- Anisotropy Bug HOT 1
- Furnace test fails when specTrans ~ 0.5
- hello,Why is this error when I open and build the solution in vs after I do my project cmake? How Do We Fix This? HOT 6
- HI!!!u are so awsome that could write so large programme. im a student,and i want to know how to learn it ? or do sir have some course about it? HOT 1
- How to export Blender scene step by step? HOT 3
- Bug(s) in Rust port HOT 8
- why use tile rendering HOT 7
- when rendering,why divide a Framebuffer into some Tiles HOT 5
- Running [Make] in Apple M2 : Undefined symbols for architecture arm64 HOT 8
- Density / Fog Integration HOT 4
- Absorption HOT 2
- Request: Change movement HOT 1
- Request: Change GUI
- I saw a very magical piece of code
- Bug: mouse pan/zoom only work after first mouse rotation HOT 1
- Water in tropical island scene is always black HOT 4
- Is it possible make Blender addon not exporter? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from glsl-pathtracer.