Description[patch originally submitted to: http://projects.blender.org/tracker/?func=detail&aid=26461&group_id=9&atid=127 ]
This patch follows (with small changes) the proposal presented here - http://wiki.blender.org/index.php/User:Dfelinto/TexFace
Not implemented: Backward Compatibility. Please refer to the bf-committers for discussions on that.
Other technical discussions, bugs, reviews, can happen here.
Summary:
========
The idea here is to move the texface options into the material panel.
See the wip.jpg and ui.jpg images for the final UI (the one in the proposal had to be changed).
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 - Code that needs review:
===================
2.1) set_draw_settings_cached
this function was changed considerably. I think I could pass the material instead of flags and do the guessing game inside the function. Thoughts?
2.2) defines, defines, defines
They are a few defines with the same value. We had more (and even some hardcoded values :/). What I did was to avoid bringing the DNA_material_types.h defines all the way to the Rasterizer. So Rasterizer has its own defines. The code is commented to make it easy for grep them.
I'm not sure, however, if this is a good idea - or if the best way to do it is to use the GEMAT_ defines everywhere.
2.3) As a user I can't understand how ZSorting would affect Add Alpha. I tried indeed and nothing happens. The BGE code, however, consider valid the combination Add + Sort. Standing to the perception that Add shouldn't have sorting, I brought the sort option as part of the blending menu, so we have opaque, add, clip, blend alpha and blend alpha sort. In the code I could, after setting the material to use zsort, to convert GEMAT_ ALPHA_SORT to GEMAT_ALPHA. It works fine indeed. However I prefered to create the GPU_BLEND_ equivalent of the GEMAT_ALPHA_SORT and deal with that in the gpu as if it's alpha.
3 - Random Notes:
============
3.1) Now "Use Face Textures" in material Option panel will work in Multitexture even if there is no texture channel.
3.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?
3.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.4) Attached also two of the sample files I used for tests - shadeless.blend and everything.blend. [ actually I don't see where to add more files here, so you can get them in the original report -
http://projects.blender.org/tracker/?func=detail&aid=26461&group_id=9&atid=127 ]
3.5) I don't expect anyone to understand the whole patch. It involves a lot of areas that I myself wasn't familiar before doing this code. But a review in the general structure and one or other specific area would be nice.
Thanks,
Dalai
Patch Set 1 #
Total comments: 27
Patch Set 2 : Update with suggestions from 1st reviews. Also test to see if new patch integrates well. #
Total comments: 7
Patch Set 3 : Update with alphablend rename + fix for a bug in GLSL 3dview (derived mesh was still using tface) #
Total comments: 4
Patch Set 4 : readfile fixed (it was an EOL problem) - backward compatibility partially implemented #Patch Set 5 : New patch, doversion + backward compatibility (Help Menu) working #
Total comments: 3
Patch Set 6 : fixed Benoit's comments + problem with meshes with no material. #
Total comments: 9
Patch Set 7 : fix for alpha (from Benoit's comment) + fix for faces w no material (the mat was being decoded 2x) #Patch Set 8 : materialpop fix was committed, so now I uncommented the material pop function #Patch Set 9 : fix for Benoit's suggestions (over email). waiting bug/patch #28111 to be committed #Patch Set 10 : update after mat_nr fix + convert mesh (UV) only once (using TF_CONVERTED): it's all good now #Patch Set 11 : create materials when no materials existent (Ton's suggestion) + mode doversion inside liblink_mesh #Patch Set 12 : No change, only updating the patch to 2.60 #Patch Set 13 : doversion unified with material code. using BKE_report for error. next: alpha fix and I'm finished. #Patch Set 14 : "Final" patch - alpha working (Brecht pls see drawobject.c). couldn't get BKE_report to popup error) #Patch Set 15 : fixing bugs I found with my test files. one bug left: http://goo.gl/jExRs shows solid in 3d view #Patch Set 16 : fixed a bunch of corner cases, glsl and multitexture should be good now. need to test more files #Patch Set 17 : Rename TwoSided to Back Culling + set it on by default + fixes for multitexture - final builds tmr #Patch Set 18 : reverted twosided by default - now back cull is off bu default #Patch Set 19 : final functional patch. doversion could be faster if I flag the material as converted. but it work. #Patch Set 20 : Final patch - to be committed tomorrow morning #MessagesTotal messages: 46
|