Commit Graph

279 Commits

Author SHA1 Message Date
b8e96e70dc better to generate the library string always because it could lead to null pointer dereferences. I don't have a non-shader system to check so skipping the conditional just to be safe 2011-12-17 13:02:31 +00:00
7d2fbfeb9f move GPU_code_generate_glsl_lib to GPU_extensions_init. This makes more sense as we cleanup the library string in GPU_extensions_exit. Thanks to Mitchel Stokes for reporting and proposing this 2011-12-17 12:58:20 +00:00
ad96dacbc5 style edit only - move parenthesis onto second line of function definition (in keeping with most of blenders code)
also split some long lines in own code.
2011-12-17 00:52:36 +00:00
3311164b24 Math lib: matrix multiplication order fix for two functions that were
inconsistent with similar functions & math notation:

mul_m4_m4m4(R, B, A) => mult_m4_m4m4(R, A, B)
mul_m3_m3m4(R, B, A) => mult_m3_m3m4(R, A, B)

For branch maintainers, it should be relatively simple to fix things manually,
it's also possible run this script after merging to do automatic replacement:
http://www.pasteall.org/27459/python
2011-12-16 19:53:12 +00:00
2253b63c97 static functions for getting power of 2 values were being copied about too much, add to the BLI_math api.
- is_power_of_2_i
- power_of_2_min_i
- power_of_2_max_i
2011-12-16 09:25:07 +00:00
6ccc605660 Bicubic bump map filtering.
This commit introduces bicubic bump map capabilities for the viewport for OpenGL 3.0+ capable GPUs. 

To use the functionality change the bump mapping method to "best quality"
Previous "best quality" setting becomes "medium quality" now.
For non OpenGL 3.0 GPUs this becomes the same as "medium quality"

Also:
* added tooltip descriptions to the bump method settings.
* modified the shader to ommit extraneous matrix multiplications for matrices already provided by OpenGL.

Bicubic shader by Morten Mikkelsen. Thanks a lot!

Oh...and FIRST!
2011-12-15 13:58:09 +00:00
3f39fde373 Compile fix for r.42546 typo 2011-12-10 03:24:19 +00:00
ae17390b77 picky edits & regen man page 2011-12-10 01:07:22 +00:00
82b9e4d16f verify existence of dm 2011-12-10 01:00:12 +00:00
965c287630 fixes scale on derivative maps 2011-12-09 23:26:06 +00:00
a5fb261016 Fix #29520: issue drawing with VBO + GLSL + alpha pass. Includes some refactoring
to hopefully make alpha material drawing code more clear.
2011-12-07 22:03:49 +00:00
b7db2587fb Cycles: fix glsl error when using light path node. 2011-12-01 19:31:36 +00:00
f62ad8f69b remove header text:
"The Blender Foundation also sells licenses for use in proprietary software under the Blender Licens"

also remove NaN references from files that have been added since blender went opensource.
2011-11-29 10:54:47 +00:00
6e28ac2d7b pep8 edits and avoid naming conflicts with python builtins 2011-11-24 19:36:12 +00:00
6673c76e78 Muting node patch: second part. Also fix [#27636] Muting shading nodes is ignored
Now, compositing, shading and texture nodes have a consistent muting system, with default behaving as previous (for compo), and which can be optionaly customized by each node.
Shader nodes are also GLSL muted.

However, Cycles is currently unaware of muted nodes, will try to address this…
2011-11-20 16:38:23 +00:00
e731ffb648 Cycles: Oren-Nayar BSDF support. This is not a separate shader node, rather it
is available through the Roughness input on the Diffuse BSDF.
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Shaders#Diffuse

Patch by Yasuhiro Fujii, thanks!
2011-11-14 17:31:47 +00:00
74387f44af Fix #29252: GLSL not working with geometry material node after recent changes. 2011-11-14 12:47:47 +00:00
e84c0980a3 correct indentation and some whitespace edits (no functional changes) 2011-11-11 13:09:14 +00:00
094c9799f9 quiet -Wdouble-promotion warnings 2011-11-11 12:00:08 +00:00
28ee0f9218 Texturing: texture and 3d view draw type changes, these should only have any
effect for a render engine using new shading nodes. In short:

* No longer uses images assigned to faces in the uv layer, rather the active
  image texture node is what is edited/painted/drawn.
* Textured draw type now shows the active image texture node, with solid
  lighting.
* Material draw mode shows GLSL shader of a simplified material node tree,
  using solid lighting.
* Textures for modifiers, brushes, etc, are now available from a dropdown in
  the texture tab in the properties editor. These do not use new shading nodes
  yet.

http://wiki.blender.org/index.php/Dev:2.6/Source/Render/TextureWorkflow
2011-11-08 13:07:16 +00:00
db75cc4cde Nodes: add cycles shader nodes, these will only be available to render engines
that use the new shading nodes system. Documentation:

http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes
2011-11-08 11:38:16 +00:00
96d73bfdcf replace VECCOPY with copy_v3_v3, same for 2d copy, also added vec copy functions for int & char. 2011-11-07 01:38:32 +00:00
85540d5aa7 more macro --> BLI math lib, mainly replace VECCOPY in render and blenkernel. 2011-11-06 16:38:21 +00:00
a71e2c498c GPU Buffers
Small type cleanup, use `GPU_Buffers *' rather than `void *'. Should
be no functional changes.
2011-11-05 03:29:37 +00:00
ed77c356fc Fix: OpenGL renders on graphics cards which do not support non-power-of-two
textures were stretched and the wrong size.
2011-10-28 16:57:06 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
0a4814a6d0 Fix #28766: object properties > display > transparency no longer worked in solid
draw mode, after texface changes.
2011-10-05 15:28:02 +00:00
79307369fe Bump maps flip: now white means salience, black means concavity
Files created in blender before this revision should be rendered in
exactly the same way they used to render before.

Patch by Morten Mikkelsen, finished by Ton and me.
2011-09-30 09:55:21 +00:00
35f881b44d Commented and tagged some unused vars, added some var init (gcc warnings...) 2011-09-28 15:22:13 +00:00
018fa1540e whitespace edits, make formatting for functions consustent at least within the file. 2011-09-28 05:53:40 +00:00
274b9c8fb8 whitespace cleanup 2011-09-25 12:31:21 +00:00
68a9450dd1 addendum to prev bugfix on texture space bump 2011-09-22 05:36:52 +00:00
Dalai Felinto
b263aefb0e TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes

1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)

2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.

2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?

2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct  (Campbell and Brecht proposal).

3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.

3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).

3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.

4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.

Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
2222f536f8 use replace 0 with NULL for pointers, set some functions static
also fixed own errors in recent static check commit.
2011-09-16 08:20:21 +00:00
0abe1911d5 - fix for access past the buffer size (paint / sculpt used some 2d vecs as 3d)
- remove redundant NULL checks on old code where it would crash if the result was NULL later on.
- add some missing NULL checks.
2011-09-16 06:47:01 +00:00
b8bf0ee822 Fix #28613: SEGFAULT: When setting Best-Quality on a Bump Map in GLSL viewport
Problem was caused by CRLF line ending instead of LF line ending.
Re-generate pu_shader_material to use LF line ending and made gpu codegen
treat \r as space character.
2011-09-12 09:47:28 +00:00
01744abd81 GPU: add gpu python module with export_shader() function to export GLSL shader.
shader = gpu.export_shader(scene,material) 

Returns the GLSL shader that blender generates to produce the visual effect
of material in scene for the purpose of reusing the shader in an external engine.
This function is meant to be used in a material exporter so that the GLSL
shader can be exported entirely. The return value is a dictionary containing the
shader source code and all associated data. 

The full documentation is under sphinx.

Warning: there has been an API between the patch and this commit:
uniform['lamp'] and uniform['image'] now return python reference to 
ID block instead of ID name as before. The X3D exporter that uses this
function must be adapted.
2011-09-09 11:55:38 +00:00
Lukas Toenne
8e0fe8bff7 Merged the particles-2010 branch with node improvements into trunk.
This branch adds mostly organizational improvements to the node system by renaming the node folders and files. A couple of internal features have been added too.
Detailed information can be found on the wiki page:

http://wiki.blender.org/index.php/User:Phonybone/Particles2010
2011-09-05 21:01:50 +00:00
b3704f45c4 Fixes for snprintf usage:
* replace by BLI_snprintf in various places, note _snprintf on windows
  does not properly null terminate the string.
* fix overflow in sequencer proxy code due to buffer being smaller than
  specified size.
* fix some usage of snprintf as strcpy, this is will go wrong if the
  string contains % characters.
* remove BLI_dynstr_printf function in gpu module, use BLI_dynstr_appendf
2011-08-30 10:07:50 +00:00
fa2ba5fbf5 - use static vars and functions where possible.
- use NULL rather than 0 when used as pointers.
2011-08-28 05:06:30 +00:00
c96f28a718 - use %u rather tham %d for unsigned ints in string formatting funcs.
- replace (strlen(str) == 0) with str[0]=='\0'
2011-08-27 03:25:02 +00:00
6926060185 - fix for BL_Shader::SetUniform() missing out the last part of the matrix.
- particle.c wasn't setting all components of the vector when reading cache and setting dummy velocity values.
- some functions incorrectly took a float[3] argument when the 4th value was set.
- remove a few redundant lines of code.
2011-08-27 03:20:32 +00:00
abff0032c4 Fix #28343: glsl error after derivative maps commit. 2011-08-23 13:15:18 +00:00
6a374d266d glsl and render support for derivative maps 2011-08-22 19:57:54 +00:00
a7de5fc191 Code cleanup: small glsl mesh drawing code changes, getting rid of an ugly macro. 2011-08-12 18:17:28 +00:00
b8dcf3a662 Fix part of #27944: color managment discrepancy in GLSL materials with nodes. 2011-07-28 14:28:27 +00:00
48a64ffa70 more minor warning cleanups and improve error reporting if text fails to save. 2011-07-27 06:55:20 +00:00
5792bd7cc7 cmake: cleanup include paths, some duplicates and going up some unneeded dirs. 2011-07-17 09:11:13 +00:00
1fd33b6e77 cmake option to build without smoke sim: WITH_MOD_SMOKE 2011-07-13 18:40:21 +00:00
abdf420a6d == GPU Buffers ==
This patch attempts to clean up and document the GPU buffers
code. There are a few bug fixes as well.

Patch reviewed here: http://codereview.appspot.com/4631052/

Summary:

* Bugfix: make GPU_buffer_copy_normal convert from shorts to floats
  correctly, also fixed the use of cached face normal CustomData.

* Bugfix: changed the `mat_nr' field of GPUBufferMaterial from char to
  short.

* Changed color buffer setup to not alloc a temporary copy of color
  data, just passes the MCol data in directly.

* Changed the GPU buffer pool code to make clearer what operates
  specifically on the global pool.

* Lots of refactoring for GPU_drawobject_new; should operate mostly
  the same (except got rid of one unecessary allocation), just split
  into more functions and without macros now.

* Converted some #defines into enumerations.

* Made some stuff private, pulled out of header file.

* Deleted unused function GPU_buffer_pool_free_unused().

* Removed GPU_interleaved_setup and related #defines. (I think this
  was used for editmode VBOs, but those were disabled.)

* Added lots of comments.

* Added a few comments in the code signed `--nicholas' to note places
  where I am unsure about design or usage, would be good to address
  these better.

* Code formatting changed to be more consistent with the rest of
  Blender.

* Renamed some fields and variables to be more consistent with
  Blender's naming conventions.

* Renamed some fields and variables to use more descriptive names,
  e.g. renamed `redir' to `mat_orig_to_new'.

* Removed print outs with DEBUG_VBO -- don't feel too strongly about
  this one, just not used elsewhere in Blender, could be easily added
  back if others disagree though.

* Moved the PBVH drawing code down to the bottom of the file, before
  was sitting in the middle of the other VBO code
2011-07-08 19:58:02 +00:00