Camera Lens Shift Game Engine #38451
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#38451
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system and graphics card
OSX 10.9 IntelHD 3000
Blender Version
Broken: (example: 2.69.7
4b206af
, see splash screen)Short description of error
I can't seem to get the script described here to work for the BGE:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Game_Engine/Camera#Camera_lens_shift
To manipulate the projection we can then directly modify the camera projection matrix in Python.
import bge
scene = bge.logic.getCurrentScene()
cam = scene.active_camera
get projection matrix
camatrix = cam.projection_matrix
modifying the camera projection matrix by modifying the x and y terms of the 3rd row to obtain a shift of the rendered area
camatrix- [x]- [x] = 2shiftx
camatrix- [x]- [x] = 2shitfy
cam.projection_matrix = camatrix
Here in field of view units are shiftx and shifty. So for example, for shifting the view up half a screen shifty is set to 0.5.
Note that a camera's projection_matrix attribute may not be set until after initialization scripts are executed and running this code immediately after the game starts will mess up the projection matrix.
This last sentence doesn't make much sense to me, could someone help clarify the workflow for properly executing this script for the BGE? Thank you so much!
Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps
Changed status to: 'Open'
Added subscriber: @Reilly
Added subscriber: @Ace_Dragon
According to the wiki
Camera Lens Shift
In the Blender interface, there is an option to shift the camera view on the x/y plane of the view. It is comparable to lens shift in video projectors that usually shift the image up along the Y axis. So for example, when you put the beamer on a table it does not project half of the image on the table.
Unfortunately, this parameter is not taken in account by the Game Engine.
I can't say for sure, but it almost sounds like one of those old functions that have been broken longer than anyone could remember (hence why it's actually mentioned in the wiki). Though it would be nice to get it working again providing it has use over just moving the position of the camera itself with Python (since it's in the bge.logic module).
Added subscriber: @AngusHollands-4
Note that a camera's projection_matrix attribute may not be set until after initialization scripts are executed and running this code immediately after the game starts will mess up the projection matrix.
This means the camera must be rendered from first in order to correctly initialise the internal matrices:
See this patch of mine which also addresses an aspect of this issue - it will allow the matrix to be updated first frame and then used therearfter https://developer.blender.org/T36617
Added subscriber: @ideasman42
Setting as low priority todo
Added subscriber: @dfelinto
Changed status from 'Open' to: 'Resolved'
Fixed on
f12b1790a0
(or rather, camera shift finally supported)