Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
SAM-tak committed Jul 30, 2022
1 parent a903fae commit 4d7814f
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 57 deletions.
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
# eeVR

**This project is not currently in active development, you're still free to post issues and make pull requests and I will try my best to guide you/merge, even if you have to wait a while. I do plan on coming back to this, although that won't happen for probably a year or two.**

Blender addon to render 360° and 180° images and videos in eevee engine with support for stereoscopic rendering.

## Getting Started

You will need to get [**Blender 2.8X** or **Blender 2.9X**](https://www.blender.org), install it, download the zip file from this GitHub, load the addon into Blender by installing the zip file in Blender Preferences > Add-ons > Install, search for "eeVR" under the Testing tab and click the checkbox to enable it. A tool panel will appear in the 3D Viewport with mode selection, FOV value adjustment, and buttons for rendering stills and animations. **The rendered images/image sequences will be stored in the same directory as the .blend file**.

**VRRenderer_ALT.py** is an alternative version, it includes simplified VR renderer, useful to render previews, when view angle not bigger than 180deg (better for 120deg), it will work. And it has the **custom save folder** name option, may be useful for some situations.
You will need to get [**Blender 3.x**](https://www.blender.org), install it, download the zip file from this GitHub, load the addon into Blender by installing the zip file in Blender Preferences > Add-ons > Install, search for "eeVR" under the Community tab and click the checkbox to enable it. A tool panel will appear in the 3D Viewport's **Tool tab**, FOV value adjustment, and buttons for rendering stills and animations. **The rendered images/image sequences will be stored in the same directory as the .blend file**.

**Beware this is still in development so I suggest backing up whatever project you're using this on before you begin rendering.**
![Tool Panel](img/tools-01.jpg "Tool Panel") ![Tool Panel](img/tools-02.jpg "Tool Panel")

## What doesn't work at the moment
### Stitch Margin

The script is very picky with the way the things are set up before rendering at the moment. These are the most common problems people run into:
An angle for seam blending.

- Output format must be PNG, or else the render will fail, and will potentially mess up some settings of the camera.
- Screen space effects will create visible seams in positions where the pictures join together, so it's best if those settings are turned off for the moment. **A possible way to mitigate some of the seams is to use overscan which is located under _Render Properties > Film > Overscan_**.
- Some of the rendering settings will be force set since they create issues, such as stereoscopy mode in camera settings is forced to parallel, since that was done in order to prevent seams.
Stitch Margin = 5°

These are only _some_ of the things that don't work properly yet, some can be easily fixed with a few hours of coding, some will probably take much longer. As I'm only working on this project intermittently, I cannot provide a timeline of these fixes. If you have any questionm let me know!
![Front](img/front.jpg "Front") + ![Sides](img/sides.jpg "Sides") = ![Front And Sides](img/frontandsides.jpg "Front And Sides")

### Keep in mind !
Final Image

If you have suggestions for future updates or come across any bugs don't hesitate to open up a "new issue" in the issue tab or write me an email at [andriux19960823@gmail.com](mailto:andriux19960823@gmail.com).
![Final Image](img/finalimage.jpg "Final Image")

## License

Expand All @@ -33,3 +27,7 @@ This project is licensed under the GNU General Public License v3.0 - see the [LI
## Acknowledgments

- The image conversion OpenGL shader was originally created by [Xyene](https://github.com/Xyene) and modified for use in Blender so thank you.

### Original Founder

[EternalTrail](https://github.com/EternalTrail)
46 changes: 20 additions & 26 deletions VRRenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@
from . import Properties

commdef = '''
#define PI 3.1415926535897932384626
#define FOVFRAC %f
#define SIDEFRAC %f
#define TBFRAC %f
#define HCLIP %f
#define VCLIP %f
#define HMARGIN %f
#define VMARGIN %f
#define EXTRUSION %f
#define PI 3.1415926535897932384626
#define FOVFRAC %f
#define SIDEFRAC %f
#define TBFRAC %f
#define HCLIP %f
#define VCLIP %f
#define HMARGIN %f
#define VMARGIN %f
const float INVSIDEFRAC = 1 / SIDEFRAC;
const float INVTBFRAC = 1 / TBFRAC;
const float HTEXSCALE = 1 / (1 + 2 * EXTRUSION + 2 * HMARGIN);
const float VTEXSCALE = 1 / (1 + 2 * EXTRUSION + 2 * VMARGIN);
const float HTEXSCALE = 1 / (1 + 2 * HMARGIN);
const float VTEXSCALE = 1 / (1 + 2 * VMARGIN);
const float HACTUALSIZE = 1 - 2 * HMARGIN;
const float VACTUALSIZE = 1 - 2 * VMARGIN;
Expand Down Expand Up @@ -74,7 +73,7 @@
vec2 apply_margin(vec2 src)
{
return tr(src, vec2(HMARGIN + EXTRUSION, VMARGIN + EXTRUSION), vec2(HTEXSCALE, VTEXSCALE));
return tr(src, vec2(HMARGIN, VMARGIN), vec2(HTEXSCALE, VTEXSCALE));
}
vec2 to_uv_front(vec3 pt)
Expand Down Expand Up @@ -307,8 +306,8 @@ def __init__(self, context, is_animation = False, folder = ''):
self.VFOV = eeVR.GetVFOV()
self.FOV = pi if eeVR.fovModeEnum == '180' else 2 * pi if eeVR.fovModeEnum == '360' else max(self.HFOV, self.VFOV)
self.no_back_image = (self.HFOV <= 3*pi/2)
self.no_side_images = eeVR.GetNoSidePlane() or (self.HFOV <= pi/2)
self.no_top_bottom_images = (self.VFOV <= (self.HFOV if eeVR.GetNoSidePlane() else pi/2))
self.no_side_images = (self.HFOV <= pi/2)
self.no_top_bottom_images = (self.VFOV <= pi/2)
self.createdFiles = set()

# Generate fragment shader code
Expand All @@ -320,21 +319,17 @@ def __init__(self, context, is_animation = False, folder = ''):
else:
sidefrac = sin(self.HFOV - pi/2) * 0.5
tbfrac = max(sidefrac, sin(self.VFOV - pi/2) * 0.5)

base_angle = (self.HFOV if eeVR.GetNoSidePlane() else pi/2)

margin = max(0.0, 0.5 * tan(base_angle/2 + eeVR.stitchMargin) - 0.5)
margin = max(0.0, 0.5 * tan(pi/4 + eeVR.stitchMargin) - 0.5)
hmargin = 0.0 if self.no_side_images else margin
vmargin = 0.0 if self.no_top_bottom_images else margin
extrusion = max(0.0, 0.5 * tan(base_angle/2) - 0.5) if eeVR.GetNoSidePlane() else 0.0
self.frag_shader = \
(commdef % (fovfrac, sidefrac, tbfrac, self.HFOV, self.VFOV, hmargin, vmargin, extrusion))\
(commdef % (fovfrac, sidefrac, tbfrac, self.HFOV, self.VFOV, hmargin, vmargin))\
+ (dome % domemodes[int(self.domeMethod)] if self.is_dome else equi)\
+ fetch_setup\
+ ('' if self.no_side_images else fetch_sides)\
+ ('' if self.no_top_bottom_images else fetch_top_bottom)\
+ ('' if self.no_back_image else (fetch_back % ((blend_seam_back_h if hmargin > 0.0 else '') + (blend_seam_back_v if vmargin > 0.0 else ''))))\
+ (fetch_front % ((blend_seam_front_h if hmargin > 0.0 or eeVR.GetNoSidePlane() else '') + (blend_seam_front_v if vmargin > 0.0 or eeVR.GetNoSidePlane() else '')))\
+ (fetch_front % ((blend_seam_front_h if hmargin > 0.0 else '') + (blend_seam_front_v if vmargin > 0.0 else '')))\
+ (blend_seam_sides if not self.no_side_images and vmargin > 0.0 else '')\
+ '}'

Expand Down Expand Up @@ -367,15 +362,14 @@ def __init__(self, context, is_animation = False, folder = ''):
)
aspect_ratio = base_resolution[0] / base_resolution[1]
tb_resolution = self.trans_resolution(base_resolution, 1, tbfrac, 0, 0)
tb_angle = (pi - self.HFOV if eeVR.GetNoSidePlane() else pi/2)
side_resolution = self.trans_resolution(base_resolution, sidefrac, 1, 0, vmargin)
side_angle = pi/2 + ((2 * self.scene.eeVR.stitchMargin) if vmargin > 0.0 else 0.0)
side_shift_scale = 1 / (1 + 2 * vmargin)
fb_resolution = self.trans_resolution(base_resolution, 1, 1, extrusion+hmargin, extrusion+vmargin)
fb_angle = (self.HFOV if eeVR.GetNoSidePlane() else pi/2) + ((2 * self.scene.eeVR.stitchMargin) if vmargin > 0.0 else 0.0)
fb_resolution = self.trans_resolution(base_resolution, 1, 1, hmargin, vmargin)
fb_angle = pi/2 + ((2 * self.scene.eeVR.stitchMargin) if vmargin > 0.0 else 0.0)
self.camera_settings = {
'top': (0.0, 0.5*(tbfrac-1), tb_angle, tb_resolution[0], tb_resolution[1], aspect_ratio),
'bottom': (0.0, 0.5*(1-tbfrac), tb_angle, tb_resolution[0], tb_resolution[1], aspect_ratio),
'top': (0.0, 0.5*(tbfrac-1), pi/2, tb_resolution[0], tb_resolution[1], aspect_ratio),
'bottom': (0.0, 0.5*(1-tbfrac), pi/2, tb_resolution[0], tb_resolution[1], aspect_ratio),
'right': (0.5*(sidefrac-1)*side_shift_scale, 0.0, side_angle, side_resolution[0], side_resolution[1], aspect_ratio),
'left': (0.5*(1-sidefrac)*side_shift_scale, 0.0, side_angle, side_resolution[0], side_resolution[1], aspect_ratio),
'front': (0.0, 0.0, fb_angle, fb_resolution[0], fb_resolution[1], aspect_ratio),
Expand Down
19 changes: 2 additions & 17 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"name": "eeVR",
"description": "Render in different projections using Eevee engine",
"author": "EternalTrail, SAMtak",
"version": (0, 3, 1),
"version": (0, 4, 0),
"blender": (3, 0, 0),
"location": "View3D > Tool Tab (Available when EEVEE or Workbench)",
"warning": "This addon is still in early alpha, may break your blend file!",
"wiki_url": "https://github.com/EternalTrail/eeVR",
"tracker_url": "https://github.com/SAM-tak/eeVR/issues",
"support": "TESTING",
"support": "COMMUNITY",
"category": "Render",
}

Expand Down Expand Up @@ -176,9 +176,6 @@ def draw(self, context):
col.prop(props, 'HFOV360')
col.prop(props, 'VFOV')
col.prop(props, 'stitchMargin')
col = layout.column()
col.prop(props, 'noSidePlane')
col.enabled = props.IsEnableNoSidePlane()
if context.scene.render.use_multiview and props.GetHFOV() > radians(180):
col = layout.column()
col.label(icon='ERROR', text="eeVR cannot support stereo over 180° fov correctly.")
Expand Down Expand Up @@ -271,12 +268,6 @@ class Properties(bpy.types.PropertyGroup):
description="Margin for Seam Blending in degrees",
)

noSidePlane: bpy.props.BoolProperty(
name="No Side Plane",
default=False,
description="Not render side view. This is enable when HFOV under 160",
)

cancel: bpy.props.BoolProperty(
name="Cancel",
default=True
Expand All @@ -300,12 +291,6 @@ def GetHFOV(self) -> float:
def GetVFOV(self) -> float:
return self.snap_angle(self.VFOV)

def IsEnableNoSidePlane(self):
return self.GetHFOV() < radians(165)

def GetNoSidePlane(self) -> bool:
return self.IsEnableNoSidePlane() and self.noSidePlane

@classmethod
def register(cls):
""" Register eeVR's properties to Blender """
Expand Down
Binary file added img/finalimage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/front.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/frontandsides.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sides.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/tools-01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/tools-02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4d7814f

Please sign in to comment.