From 3177c4f69fcb53c2aad744ee951ea60d98a77c86 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Tue, 5 Dec 2006 16:43:01 +0000 Subject: Next stage of RenderPipe refactor: now everything within the pixel was tackled. Resulting features: - render passes - new pass: Object Index, for masking - sub-sample alpha masks Docs: http://mediawiki.blender.org/index.php/BlenderDev/RenderPipeline http://www.blender3d.org/cms/Render_Passes.829.0.html http://www.blender3d.org/cms/New_Render_features.774.0.html Note that these changes might mean things to not render fully identical... For the next days a lot of testing is needed! --- .../blender/render/intern/include/pixelblending.h | 8 --- .../blender/render/intern/include/pixelshading.h | 5 +- .../blender/render/intern/include/render_types.h | 17 +++-- source/blender/render/intern/include/rendercore.h | 26 ++------ source/blender/render/intern/include/shading.h | 75 ++++++++++++++++++++++ source/blender/render/intern/include/zbuf.h | 2 +- 6 files changed, 96 insertions(+), 37 deletions(-) create mode 100644 source/blender/render/intern/include/shading.h (limited to 'source/blender/render/intern/include') diff --git a/source/blender/render/intern/include/pixelblending.h b/source/blender/render/intern/include/pixelblending.h index 2713b2023a9..04c5a3977a3 100644 --- a/source/blender/render/intern/include/pixelblending.h +++ b/source/blender/render/intern/include/pixelblending.h @@ -62,14 +62,6 @@ void addalphaAddFloat(float *dest, float *source); */ void addalphaUnderGammaFloat(float *doel, float *bron); -/** -* Copy the colour buffer output to R.rectot, to line y. - */ -void transferColourBufferToOutput(float *buf, int y); -/** -* using default transforms for brightness, gamma, hue, saturation etc. - */ -void std_floatcol_to_charcol(float *buf, char *target); #endif /* PIXELBLENDING_EXT_H */ diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h index 67b0e5bcf3c..88c93a147fc 100644 --- a/source/blender/render/intern/include/pixelshading.h +++ b/source/blender/render/intern/include/pixelshading.h @@ -53,9 +53,8 @@ void shadeHaloFloat(HaloRen *har, /** * Render the sky at pixel (x, y). */ -void renderSkyPixelFloat(float *collector, float x, float y, float *rco); -void shadeSkyPixel(float *collector, float fx, float fy, float *rco); -void shadeSkyPixelFloat(float *colf, float *rco, float *view, float *dxyview); +void shadeSkyPixel(float *collector, float fx, float fy); +void shadeSkyView(float *colf, float *rco, float *view, float *dxyview); /* ------------------------------------------------------------------------- */ diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 3ac56e73099..77beb446c86 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -253,9 +253,8 @@ typedef struct RadFace { int flag; } RadFace; -typedef struct VlakRen -{ - struct VertRen *v1, *v2, *v3, *v4; +typedef struct VlakRen { + struct VertRen *v1, *v2, *v3, *v4; /* keep in order for ** addressing */ unsigned int lay; float n[3]; struct Material *mat; @@ -290,8 +289,12 @@ struct MTex; * For each lamp in a scene, a LampRen is created. It determines the * properties of a lightsource. */ -typedef struct LampRen -{ + +typedef struct LampShadowSample { + float shadfac[16][4]; /* 16 = RE_MAX_OSA, 4 = rgba */ +} LampShadowSample; + +typedef struct LampRen { float xs, ys, dist; float co[3]; short type, mode; @@ -340,6 +343,10 @@ typedef struct LampRen float mat[3][3]; /* 3x3 part from lampmat x viewmat */ float area[8][3], areasize; + /* passes & node shader support: all shadow info for a pixel */ + /* struct is currently 2k long... check on alloc? */ + LampShadowSample shadsamp[BLENDER_MAX_THREADS]; + /* yafray: photonlight params */ int YF_numphotons, YF_numsearch; short YF_phdepth, YF_useqmc, YF_bufsize; diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index e70913fbbde..9f22480f0cb 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -47,17 +47,11 @@ struct HaloRen; struct ShadeInput; struct ShadeResult; struct World; +struct RenderPart; +struct RenderLayer; /* ------------------------------------------------------------------------- */ -/* to make passing on variables to shadepixel() easier */ -typedef struct ShadePixelInfo { - int thread; - int layflag, passflag; - unsigned int lay; - ShadeResult shr; -} ShadePixelInfo; - typedef struct PixStr { struct PixStr *next; @@ -79,25 +73,17 @@ typedef struct PixStrMain void calc_view_vector(float *view, float x, float y); float mistfactor(float zcor, float *co); /* dist and height, return alpha */ +void renderspothalo(struct ShadeInput *shi, float *col, float alpha); void add_halo_flare(Render *re); -void shade_input_set_coords(ShadeInput *shi, float u, float v, int i1, int i2, int i3); - -void shade_color(struct ShadeInput *shi, ShadeResult *shr); -void shade_lamp_loop(struct ShadeInput *shi, ShadeResult *shr); - -float fresnel_fac(float *view, float *vn, float fresnel, float fac); -void calc_R_ref(struct ShadeInput *shi); +void calc_renderco_zbuf(float *co, float *view, int z); +void calc_renderco_ortho(float *co, float x, float y, int z); -/* for nodes */ -void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr); +int count_mask(unsigned short mask); void zbufshade(void); void zbufshadeDA(void); /* Delta Accum Pixel Struct */ -void *shadepixel(ShadePixelInfo *shpi, float x, float y, int z, volatile int facenr, int mask, float *rco); -int count_mask(unsigned short mask); - void zbufshade_tile(struct RenderPart *pa); void zbufshadeDA_tile(struct RenderPart *pa); diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h new file mode 100644 index 00000000000..38ed0f73e70 --- /dev/null +++ b/source/blender/render/intern/include/shading.h @@ -0,0 +1,75 @@ +/** +* $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; + +/* shadeinput.c */ + + +/* needed to calculate shadow and AO for an entire pixel */ +typedef struct ShadeSample { + int tot; /* amount of shi in use, can be 1 for not FULL_OSA */ + ShadeInput shi[16]; /* RE_MAX_OSA */ + ShadeResult shr[16]; /* RE_MAX_OSA */ +} ShadeSample; + + + /* also the node shader callback */ +void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr); + +void shade_input_set_triangle_i(struct ShadeInput *shi, struct VlakRen *vlr, short i1, short i2, short i3); +void shade_input_set_triangle(struct ShadeInput *shi, volatile int facenr, int normal_flip); +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); +void shade_input_set_shade_texco(struct ShadeInput *shi); +void shade_input_do_shade(struct ShadeInput *shi, struct ShadeResult *shr); + +void shade_sample_initialize(struct ShadeSample *ssamp, struct RenderPart *pa, struct RenderLayer *rl); +void shade_samples_do_shadow(struct ShadeSample *ssamp); +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); + +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); diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h index 993ca711a18..c308ae25bce 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/include/zbuf.h @@ -49,7 +49,7 @@ int testclip(float *v); void set_part_zbuf_clipflag(struct RenderPart *pa); void zbuffer_shadow(struct Render *re, struct LampRen *lar, int *rectz, int size, float jitx, float jity); void zbuffer_solid(struct RenderPart *pa, unsigned int layer, short layflag); -void zbuffer_transp_shade(struct RenderPart *pa, struct RenderLayer *rl, float *pass); +unsigned short *zbuffer_transp_shade(struct RenderPart *pa, struct RenderLayer *rl, float *pass); void convert_zbuf_to_distbuf(struct RenderPart *pa, struct RenderLayer *rl); typedef struct APixstr { -- cgit v1.2.3