2006-12-05 16:43:01 +00:00
|
|
|
/**
|
|
|
|
* $Id:
|
|
|
|
*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2006 Blender Foundation
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct ShadeInput;
|
|
|
|
struct ShadeResult;
|
|
|
|
struct RenderPart;
|
|
|
|
struct RenderLayer;
|
|
|
|
struct PixStr;
|
2006-12-08 09:40:44 +00:00
|
|
|
struct LampRen;
|
2007-12-04 13:57:28 +00:00
|
|
|
struct VlakRen;
|
|
|
|
struct StrandSegment;
|
|
|
|
struct StrandPoint;
|
Render Instancing
=================
Big commit, but little user visible changes.
- Dupliverts and duplifaces are now rendered as instances, instead
of storing all of the geometry for each dupli, now an instance is
created with a matrix transform refering to the source object.
This should allow us to render tree leaves more memory efficient.
- Radiosity and to some degree raytracing of such objects is not
really efficient still. For radiosity this is fundamentally hard
to solve, but raytracing an octree could be created for each object,
but the current octree code with it's fixed size doesn't allow this
efficiently.
- The regression tests survived, but with I expect that some bugs will
pop up .. hopefully not too many :).
Implementation Notes
====================
- Dupligroups and linked meshes are not rendered as instances yet,
since they can in fact be different due to various reasons,
instancing of these types of duplis that are the same can be added
for them at a later point.
- Each ObjectRen now stores it's own database, instead of there being
one big databases of faces, verts, .. . Which objects that are actually
rendered are defined by the list of ObjectRenInstances, which all refer
to an ObjectRen.
- Homogeneous coordinatess and clipping is now not stored in vertices
anymore, but instead computed on the fly. This couldn't work for
instances. That does mean some extra computation has to be done, but
memory lookups can be slow too, and this saves some memory. Overall
I didn't find a significant speed impact.
- OSA rendering for solid and ztransp now is different. Instead of e.g.
going 8 times over the databases times and rendering the z-buffer, it
now goes over the database once and renders each polygon 8 times. That
was necessary to keep instances efficient, and can also give some
performance improvement without instances.
- There was already instancing support in the yafray export code, now it
uses Blender's render instances for export.
- UV and color layer storage in the render was a bit messy before, now
should be easier to understand.
- convertblender.c was reorganized somewhat. Regular render, speedvector
and baking now use a single function to create the database, previously
there was code duplicated for it.
- Some of these changes were done with future multithreading of scene
and shadow buffer creation in mind, though especially for scene creation
much work remains to be done to make it threadsafe, since it also involves
a lot of code from blenkernel, and there is an ugly conflict with the way
dupli groups work here .. though in the render code itself it's almost there.
2007-12-15 20:41:45 +00:00
|
|
|
struct ObjectInstanceRen obi;
|
2006-12-05 16:43:01 +00:00
|
|
|
|
|
|
|
/* shadeinput.c */
|
|
|
|
|
2006-12-21 13:47:27 +00:00
|
|
|
#define RE_MAX_OSA 16
|
2006-12-05 16:43:01 +00:00
|
|
|
|
|
|
|
/* needed to calculate shadow and AO for an entire pixel */
|
|
|
|
typedef struct ShadeSample {
|
2008-01-28 16:33:59 +00:00
|
|
|
int tot; /* amount of shi in use, can be 1 for not FULL_OSA */
|
|
|
|
|
|
|
|
RenderLayer *rlpp[RE_MAX_OSA]; /* fast lookup from sample to renderlayer (fullsample buf) */
|
2006-12-08 09:40:44 +00:00
|
|
|
|
|
|
|
/* could be malloced once */
|
2006-12-21 13:47:27 +00:00
|
|
|
ShadeInput shi[RE_MAX_OSA];
|
|
|
|
ShadeResult shr[RE_MAX_OSA];
|
2006-12-05 16:43:01 +00:00
|
|
|
} ShadeSample;
|
|
|
|
|
|
|
|
|
|
|
|
/* also the node shader callback */
|
|
|
|
void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr);
|
2008-09-22 01:51:24 +00:00
|
|
|
void shade_volume_loop(struct ShadeInput *shi, struct ShadeResult *shr);
|
2006-12-05 16:43:01 +00:00
|
|
|
|
Render Instancing
=================
Big commit, but little user visible changes.
- Dupliverts and duplifaces are now rendered as instances, instead
of storing all of the geometry for each dupli, now an instance is
created with a matrix transform refering to the source object.
This should allow us to render tree leaves more memory efficient.
- Radiosity and to some degree raytracing of such objects is not
really efficient still. For radiosity this is fundamentally hard
to solve, but raytracing an octree could be created for each object,
but the current octree code with it's fixed size doesn't allow this
efficiently.
- The regression tests survived, but with I expect that some bugs will
pop up .. hopefully not too many :).
Implementation Notes
====================
- Dupligroups and linked meshes are not rendered as instances yet,
since they can in fact be different due to various reasons,
instancing of these types of duplis that are the same can be added
for them at a later point.
- Each ObjectRen now stores it's own database, instead of there being
one big databases of faces, verts, .. . Which objects that are actually
rendered are defined by the list of ObjectRenInstances, which all refer
to an ObjectRen.
- Homogeneous coordinatess and clipping is now not stored in vertices
anymore, but instead computed on the fly. This couldn't work for
instances. That does mean some extra computation has to be done, but
memory lookups can be slow too, and this saves some memory. Overall
I didn't find a significant speed impact.
- OSA rendering for solid and ztransp now is different. Instead of e.g.
going 8 times over the databases times and rendering the z-buffer, it
now goes over the database once and renders each polygon 8 times. That
was necessary to keep instances efficient, and can also give some
performance improvement without instances.
- There was already instancing support in the yafray export code, now it
uses Blender's render instances for export.
- UV and color layer storage in the render was a bit messy before, now
should be easier to understand.
- convertblender.c was reorganized somewhat. Regular render, speedvector
and baking now use a single function to create the database, previously
there was code duplicated for it.
- Some of these changes were done with future multithreading of scene
and shadow buffer creation in mind, though especially for scene creation
much work remains to be done to make it threadsafe, since it also involves
a lot of code from blenkernel, and there is an ugly conflict with the way
dupli groups work here .. though in the render code itself it's almost there.
2007-12-15 20:41:45 +00:00
|
|
|
void shade_input_set_triangle_i(struct ShadeInput *shi, struct ObjectInstanceRen *obi, struct VlakRen *vlr, short i1, short i2, short i3);
|
|
|
|
void shade_input_set_triangle(struct ShadeInput *shi, volatile int obi, volatile int facenr, int normal_flip);
|
2006-12-05 16:43:01 +00:00
|
|
|
void shade_input_copy_triangle(struct ShadeInput *shi, struct ShadeInput *from);
|
|
|
|
void shade_input_set_viewco(struct ShadeInput *shi, float x, float y, float z);
|
|
|
|
void shade_input_set_uv(struct ShadeInput *shi);
|
|
|
|
void shade_input_set_normals(struct ShadeInput *shi);
|
Render Instancing
=================
Big commit, but little user visible changes.
- Dupliverts and duplifaces are now rendered as instances, instead
of storing all of the geometry for each dupli, now an instance is
created with a matrix transform refering to the source object.
This should allow us to render tree leaves more memory efficient.
- Radiosity and to some degree raytracing of such objects is not
really efficient still. For radiosity this is fundamentally hard
to solve, but raytracing an octree could be created for each object,
but the current octree code with it's fixed size doesn't allow this
efficiently.
- The regression tests survived, but with I expect that some bugs will
pop up .. hopefully not too many :).
Implementation Notes
====================
- Dupligroups and linked meshes are not rendered as instances yet,
since they can in fact be different due to various reasons,
instancing of these types of duplis that are the same can be added
for them at a later point.
- Each ObjectRen now stores it's own database, instead of there being
one big databases of faces, verts, .. . Which objects that are actually
rendered are defined by the list of ObjectRenInstances, which all refer
to an ObjectRen.
- Homogeneous coordinatess and clipping is now not stored in vertices
anymore, but instead computed on the fly. This couldn't work for
instances. That does mean some extra computation has to be done, but
memory lookups can be slow too, and this saves some memory. Overall
I didn't find a significant speed impact.
- OSA rendering for solid and ztransp now is different. Instead of e.g.
going 8 times over the databases times and rendering the z-buffer, it
now goes over the database once and renders each polygon 8 times. That
was necessary to keep instances efficient, and can also give some
performance improvement without instances.
- There was already instancing support in the yafray export code, now it
uses Blender's render instances for export.
- UV and color layer storage in the render was a bit messy before, now
should be easier to understand.
- convertblender.c was reorganized somewhat. Regular render, speedvector
and baking now use a single function to create the database, previously
there was code duplicated for it.
- Some of these changes were done with future multithreading of scene
and shadow buffer creation in mind, though especially for scene creation
much work remains to be done to make it threadsafe, since it also involves
a lot of code from blenkernel, and there is an ugly conflict with the way
dupli groups work here .. though in the render code itself it's almost there.
2007-12-15 20:41:45 +00:00
|
|
|
void shade_input_flip_normals(struct ShadeInput *shi);
|
2006-12-05 16:43:01 +00:00
|
|
|
void shade_input_set_shade_texco(struct ShadeInput *shi);
|
2007-12-04 13:57:28 +00:00
|
|
|
void shade_input_set_strand(struct ShadeInput *shi, struct StrandRen *strand, struct StrandPoint *spoint);
|
|
|
|
void shade_input_set_strand_texco(struct ShadeInput *shi, struct StrandRen *strand, struct StrandVert *svert, struct StrandPoint *spoint);
|
2006-12-05 16:43:01 +00:00
|
|
|
void shade_input_do_shade(struct ShadeInput *shi, struct ShadeResult *shr);
|
|
|
|
|
2006-12-08 09:40:44 +00:00
|
|
|
void shade_input_initialize(struct ShadeInput *shi, struct RenderPart *pa, struct RenderLayer *rl, int sample);
|
|
|
|
|
2006-12-05 16:43:01 +00:00
|
|
|
void shade_sample_initialize(struct ShadeSample *ssamp, struct RenderPart *pa, struct RenderLayer *rl);
|
2006-12-08 09:40:44 +00:00
|
|
|
void shade_samples_do_AO(struct ShadeSample *ssamp);
|
2008-01-17 19:27:16 +00:00
|
|
|
void shade_samples_fill_with_ps(struct ShadeSample *ssamp, struct PixStr *ps, int x, int y);
|
2006-12-05 16:43:01 +00:00
|
|
|
int shade_samples(struct ShadeSample *ssamp, struct PixStr *ps, int x, int y);
|
|
|
|
|
|
|
|
void vlr_set_uv_indices(struct VlakRen *vlr, int *i1, int *i2, int *i3);
|
|
|
|
|
|
|
|
void calc_R_ref(struct ShadeInput *shi);
|
|
|
|
|
|
|
|
|
|
|
|
/* shadeoutput. */
|
|
|
|
void shade_lamp_loop(struct ShadeInput *shi, struct ShadeResult *shr);
|
|
|
|
|
|
|
|
void shade_color(struct ShadeInput *shi, ShadeResult *shr);
|
|
|
|
|
|
|
|
void ambient_occlusion_to_diffuse(struct ShadeInput *shi, float *diff);
|
|
|
|
void ambient_occlusion(struct ShadeInput *shi);
|
|
|
|
|
2008-09-22 01:51:24 +00:00
|
|
|
ListBase *get_lights(struct ShadeInput *shi);
|
2006-12-05 16:43:01 +00:00
|
|
|
float lamp_get_visibility(struct LampRen *lar, float *co, float *lv, float *dist);
|
|
|
|
void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real);
|
|
|
|
|
|
|
|
float fresnel_fac(float *view, float *vn, float fresnel, float fac);
|