[Bf-committers] [bf-blender-Patches][6842] A new procedural texture implementation to generate tiling patterns

Ahmad Kabani ahmadkabani at yahoo.com
Thu Jan 10 16:39:19 CET 2008


Hi guys,

I've been very busy lately and therefore no more updates to this patch. However since it was reviewed by Martin, I was wondering what the next step is; I understand Ton needs to review this first. Just probing so it is not completely forgotten.

Best regards,

Ahmad

----- Original Message ----
From: "noreply at projects.blender.org" <noreply at projects.blender.org>
To: noreply at projects.blender.org
Sent: Monday, December 17, 2007 6:53:27 AM
Subject: [bf-blender-Patches][6842] A new procedural texture implementation to generate tiling patterns

Patches item #6842, was opened at 2007-06-13 17:38
You can respond by visiting: 
http://projects.blender.org/tracker/?func=detail&atid=127&aid=6842&group_id=9
Or by replying to this e-mail entering your response between the
 following markers: 
#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+
(enter your response here)
#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+

Status: Open
Priority: 3
Submitted By: Ahmad Kabani (wizard)
Assigned to: Martin Poirier (theeth)
Summary: A new procedural texture implementation to generate tiling
 patterns 
Resolution: New
Group: None
Category: Rendering


Initial Comment:
This is an experimental patch to get some direction and feedback from
 the developers & the community on implementing a new procedural texture
 called "Tiles". The patch was created using "svn diff" and the supplied
 blend file has a few examples of the tiling patterns possible. It
 started as a new texture plugin and based on the communities reception,
 I've furthered this work to a new texture. See this link for the progress:
 http://blenderartists.org/forum/showthread.php?t=94666. The supplied
 blend file contains 5 examples in the first 5 layers on how the texture
 can be used to generate different patterns and textures.

The current implementation supports:
- Bump mapping and intensity function.
- Generation of a set of rectangular tiles with random width that
 repeat horizontally.
- Tiles are shifted every N rows (or infinitely if N=0) making brick
 patterns possible.
- Different types of corners (rounded, elliptical, straight cut,
 inverted rounded and inverted elliptical).
- Spacing of each tile horizontally and vertically.
- A wave function to generate ripples in the bevel.
- Default linear bevel that can be mapped to 2 cubic curves to generate
 inset and outset profiles. A slider does a linear blend between the 3
 functions and a toggle allows smoothing of the resulting function.
- Rotation and skewing of texture coordinates.

The following parameters are available in the interface:
  Scale: Sets scaling
  Count: Number of random tiles
  Seed:  Seed for random number generator

  Min W: Minimum tile width
  Max W: Maximum tile width
  Height: Tile height

  Bevel: Tile bevel factor
  Curve: Adjust the bevel profile
  Smooth: Smooth the bevel profile

  H Gap: Horizontal spacing
  V Gap: Vertical spacing

  Shift: Tile shift
  Alternate: Number of tiles after which shifting starts again

  H Shape: Tile corner horizontal factor
  V Shape: Tile corner vertical factor
  Corner Style: Tile corner type

  Freq: Frequency of wave function for bevel
  Amp: Amplitude of wave function for bevel

I am now considering extending the texture to provide a "sub-tiling"
 feature that can generate seamless preset patterns within each tile so
 that multiple texture slots are not needed. Some very useful tiling
 patterns like herringbone, weave, etc can be added as canned patterns
 freeing up texture slots that would otherwise be needed to combine more than
 one Tile texture map.   Having such presets means that in future
 versions it would be possible to add more presets based on user feedback. A
 "none" option for presets would default back to current implementation
 if needed.


----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-12-17 06:53

Message:
One more small note about offsets and skew parameters. Texture rotation
 will rotate the entire texture after the offset and skew are applied.
 See attached tiles_off.gif for a demo.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-12-16 17:57

Message:
Just a few notes:

1. Usability and cryptic nature

In light of what the recent texture nodes implementation can do, some
 of the parameters in the advanced tab can be removed. For instance the
 Frequency/Amplitude controls that generate ripples can be handled using
 RGB curves node.

As for the cryptic nature, its kinda hard to keep it within the default
 size of panels. I expanded the width a bit but due to the large number
 of options and low GUI real-estate I resorted to this. GUI can be
 designed better and I can certainly provide extensive documentation for the
 texture.

2. Presets

You can keep adding to the Preset list every release.

3. Offset and scale parameters

Users on BlenderArtists felt the need; so I added them. I have also
 noticed that the Offset parameters help lining up tiles/bricks a bit
 better than when used from the Map Input panel; this is needed when using
 more than 2 Tiles textures together. There might be something in the
 order of transformation that might be messing up things. I can look into
 this.

4. Stretching the structure

I'm not sure what it would take to do a per-texture structure whilst
 having common parameters in a base texture struct. I come from a C++
 background.

5. As a texture plugin

I did start this off as a plugin for Blender!


I await Ton's verdict :)
Thanks for the review Martin. It is greatly appreciated.

Cheers,

Ahmad

----------------------------------------------------------------------

Comment By: Martin Poirier (theeth)
Date: 2007-12-16 17:15

Message:
Regarding usability, a lot of the parameters aren't really clear
 regarding what they do. That can be understandable with such a complex
 texture, but it will need excellent docs if you want people to juice out all
 the neat stuff it seems to be able to do, otherwise, I'd think it would
 be a bit cryptic for most (especially the options in the advanced
 tab).

The presets are varied and different enough from one another and all
 the different parameters offer incredible flexibility regarding all the
 different variations it can offer. I don't think there's a need to split
 it in more than one texture, as you asked on IRC.

The Offset and Scale parameters aren't that useful though, the same
 thing should be achievable with the texture mapping ofsXYZ and scaleXYZ
 (unless I'm missing something, in which case, correct me).

Codewise, it's stretching the texture structure A LOT, it sounds like
 it would be time to move to a per texture-type struct (like constraints,
 for example). Otherwise, it'll just be pilling up over and over. For
 that reason, I don't really feel qualified to give a final ok.

The rest seemed all right, well commented, good flow, no code-blobs.

Very good job overall.

As noted earlier, there's some questions regarding low-level structs,
 so I'm assigning to Ton for final verdict (he's on holiday right now,
 but I'll poke him to check this as soon as he gets back).

As a side note, I think this sort of meta-texture would be an excellent
 candidate for a texture plugin (packaged with Blender) if the texture
 plugin API was not the crusty old thing it currently is (IIRC).

Thanks for the good work and once again, sorry for not reviewing
 sooner.

Martin
PS: I had to fiddle a bit with the patch to apply it, so I'm attaching
 the modified version I used. It's nothing too complex.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-12-14 09:52

Message:
I've recreated patch based on latest SVN and added Domino Marama's
 suggested change for 64 bit struct alignment.

----------------------------------------------------------------------

Comment By: Domino Marama (domino)
Date: 2007-12-04 17:18

Message:
Lines 199 & 200 in patch 12a need reversing for 64 bit struct
 alignment.

+    float pad4;
+    struct TexPreCalc precalc;

should be

+    struct TexPreCalc precalc;
+    float pad;

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-11-24 14:51

Message:
* The seamless tiling function reported in the last post was wrong
 (implemented correctly though):
F_tile(x,y,z) = (
  (w - x) * (h - y) * (d - z) * F(x    , y    , z    ) +
  (w - x) * (h - y) * (    z) * F(x    , y    , z - d) +
  (w - x) * (    y) * (d - z) * F(x    , y - h, z    ) +
  (w - x) * (    y) * (    z) * F(x    , y - h, z - d) +
  (    x) * (h - y) * (d - z) * F(x - w, y    , z    ) +
  (    x) * (h - y) * (    z) * F(x - w, y    , z - d) +
  (    x) * (    y) * (d - z) * F(x - w, y - h, z    ) +
  (    x) * (    y) * (    z) * F(x - w, y - h, z - d)
 ) / whd

* Tried to optimized the above function slightly. There's 8 calls to
 BLI_gTurbulence() and there's no way to get away from it.

* In the "Tiles Basic" panel, the Preset values that use a seamless
 preset, ones that cannot be used with the Gap values, are indicated with
 an asterisk (*) besides the preset name.

* I have noticed that when you use rotation, skew and offset
 parameters, the turbulence function is not affected by them. So its like
 squeezing the tiles through the turbulence field (in 2D).

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-11-15 23:13

Message:
Added warping/turbulence controls in a 3rd panel which uses
 BLI_gTurbulence() as a warp function. The warp function is made seamless along all
 3 axis as follows:

F_tile(x,y,z) = (
  (w - x) * (h - y) * (d - z) * F(x - w, y    , z - d) +
  (w - x) * (h - y) * (    z) * F(x - w, y    , z    ) +
  (w - x) * (    y) * (d - z) * F(x - w, y - h, z - d) +
  (w - x) * (    y) * (    z) * F(x - w, y - h, z    ) +
  (    x) * (h - y) * (d - z) * F(x    , y    , z - d) +
  (    x) * (h - y) * (    z) * F(x    , y    , z    ) +
  (    x) * (    y) * (d - z) * F(x    , y - h, z - d) +
  (    x) * (    y) * (    z) * F(x    , y - h, z    )
 ) / whd

where w = h = d = 1 (since x, y, z run from -1 to 1).

Parameters:
- Soft Noise/Hard Noise Toggle
- Noise Size
- Noise Depth
- Turbulence Factor
- Noise Basis

These parameters were already present which makes the task a lot
 easier.

Screenshots:
http://www.wizardproductions.org/ahmad/blender/texture_plugins/warp1.jpg
http://www.wizardproductions.org/ahmad/blender/texture_plugins/warp2.jpg
http://www.wizardproductions.org/ahmad/blender/texture_plugins/warp4.jpg
http://www.wizardproductions.org/ahmad/blender/texture_plugins/warp3.jpg

NOTE:
One of the users noted that appending a texture from a different file
 causes the parameters to be set to default. The problem is that
 subversion level is not read during append. I'm not sure how to resolve it (I
 have bumped up subversion level to 8 and put the correct checks because
 it works when opening a file).


----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-10-25 21:45

Message:
The following site demonstrates an algorithm to determine if a point
 lies in a concave polygon and it handles convex, concave and overlapping
 polygons (where edges overlap creating holes).
http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html

I extended the algorithm to allow rendering of such polygons with a
 linear bevel around each edge. The results allow us to render crosses,
 stars, etc without breaking the shape into multiple triangles and
 rectangles. See the screenshots below. I added 3 new presets: Cross 1, Cross 2
 and Star 1.

For linear gradients, the algorithm is used to clip the shaded
 rectangular tile with the polygon.

Screenshots:
http://ahmad.wizardproductions.org/blender/texture_plugins/cross1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/cross2.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/star1.jpg


----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-10-24 20:51

Message:
* Sorted the list of presets and corner styles.
* Added a new interlocking pattern that uses regular octagons and
 squares with identical edge lengths.
* Added a function to handle concave and winding (overlapping)
 polygons. However, the default bevel preset is hard to compute when the angle
 between two edges > 180 degrees; actually the function splits it into
 beveled triangles. So for now its there if a preset will do only colour
 but no bump. If I get a chance, I will work on this some more.

Screenshots:
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock4a.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock4b.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock4c.jpg


NOTE:
I just realized that the new preset could be done more efficiently by
 realizing the pattern is rotated 45 degrees. It is essentially the None
 preset with Straight corner style with the added bonus of beveled quads
 in between. I'll leave this in for now because this preset when used
 with randomization generates irregular octagons that aren't symmetric in
 x or y axis.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-10-19 11:48

Message:
Another small patch to fix gradients used with Preset options like
 Herringbone and Weave. This will place the gradients in a direction
 perpendicular to the longest side. Some people might prefer using this to do
 diamond plate textures.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-10-15 08:29

Message:
A small patch to fix the gradients. When rounded corners were used with
 default bevels, the bevel size was tied to the radius to handle cases
 where bevel size > radius. This restriction doesn't apply to gradients.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-10-10 16:11

Message:
Added a new parameter: bevelshading. The new parameter is tied to a
 list called "Bevel Shading" besides the "Bevel Option" list in the
 Advanced panel. 

It has 4 options for now:
Default: The bevel is calculated from sides of lines, polygons,
 circles, ellipses as it used to do up until now.
H Gradient: The bevel is a linear horizontal gradient going from black
 to white to black.
V Gradient: The bevel is a linear vertical gradient going from black to
 white to black.
Preset: This can be any custom function tied to a preset. For instance,
 the Weave, Interlock 2/3 and Herringbone presets switch between
 horizontal and vertical gradients to simulate woven textures better.

Screenshots:
http://ahmad.wizardproductions.org/blender/texture_plugins/weave_gradient_2.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/herringbone_gradient_1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/herringbone_gradient_2.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock2_gradient1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock2_gradient2.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/honeycomb_gradient1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/honeycomb_gradient2.jpg


There is one area of concern. Gradients are applied and masked by the
 selected Bevel Option (circle, ellipse, etc). However, there is some
 aliasing and in order to get good results in the render the Full OSA
 property in Material panels has to be enabled. Some kind of super-sampling
 has to be performed in order to smooth out the jaggies. I'm not too
 familiar with this and if someone can point me in the right direction, I'd
 appreciate it.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-10-08 23:46

Message:
I wasn't too happy with the way the seamless tiling worked. It made the
 Width/Height controls pretty much ineffective if you really wanted to
 tweak the aspect ratio of width-to-height... the number of random tiles
 is integer based and it controlled the aspect ratio of tiles. So, I
 added a toggle button called Seamless that will revert to the infinite
 tiling behavior before patch 6 if it is deselected; useful if you don't
 care to use the 2D->3D mapping. 

If you don't understand what I am blabbing about above, then just play
 with the new control and the respective features to see what I mean.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-10-04 17:40

Message:
No need to apologize Martin! I'm kinda busy at work due to the end of
 our development cycle. 

I'll keep submitting patches for new texture presets for now so we can
 have a rich set of textures to play with.

Thanks.

----------------------------------------------------------------------

Comment By: Martin Poirier (theeth)
Date: 2007-10-04 17:07

Message:
Many apologies for the lack of replies. I've been busy a lot with
 school work in the last weeks, but don't give up, I'll get to it eventually.

Sorry again.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-10-04 16:54

Message:
Forgot to mention that patch #7 was done with latest SVN code from
 trunk. So it has version 2.45 changes. The subversion number was bumped up
 and now older blend files using this texture may or may not work.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-10-04 16:53

Message:
I quickly added 2 new presets, Interlock 2 and Interlock 3. Both handle
 random bump and color and all the other parameters. The presets
 basically divide a tile vertically into 2 or 4 rectangular tiles
 respectively. Based on N (number of horizontal & vertical tiles), the pattern gets
 rotated 90 degrees every N % 2. So a value of 2 produces the double
 weave and diamond plate textures and other values combined with shifting
 can produce variations on the basic pattern.

Screenshots:
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock2_1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock2_2.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock2_3.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock2_4.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock2_5.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/interlock2_6.jpg

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-09-20 08:18

Message:
Thanks for reviewing the code. I would like to know if you would
 integrate this as-is or if you would like to see any changes. The following
 areas are of concern to me:

1. Could there could be more options? e.g. Different beveling functions
 like horizontal/vertical gradients.
2. Any options that are useless? e.g. Amplitude/frequency options don't
 quite work very well.
2. Currently there are a few presets but there is possibility to add
 more. How many and what kind are limited by complexity since these are
 coded by hand.
3. Most presets handle both color and bump, so every new preset is in
 itself a new texture that uses the basic tiling/bevel options. Having a
 common framework to implement them might be useful. Would you like to
 split these out as new textures or keep the current implementation
 as-is?
4. General code organization: Maybe split out the tiling functions in a
 separate file?
5. Since this is a 2D texture, doesn't quite work very well with
 sculpting although it does work pretty well with Displacement modifier.

A few people at Blenderartists have played with it and generally feel
 this is a useful texture. If any changes are required, do I simply
 submit new patches for the main trunk (or branch)?

Ahmad

----------------------------------------------------------------------

Comment By: Martin Poirier (theeth)
Date: 2007-09-19 23:15

Message:
Ok, so if the code has already been reviewed, what is the next step?

If the code is already quite stable, it could be committed directly
 into trunk, if not, we could create a quick branch until it stabilize.

----------------------------------------------------------------------

Comment By: Tom Musgrove (letterrip)
Date: 2007-09-19 18:12

Message:
I've looked through it and code looks fine to me as well as well
 documented when needed.  Also it is obviously quite useful.

Martin thanks, I know it isn't your area of expertise - but the only
 person whose it is (Tons) is already loaded up with a number of others :)

----------------------------------------------------------------------

Comment By: Martin Poirier (theeth)
Date: 2007-09-12 11:52

Message:
Texture generation isn't really my area of expertise, but I'll have a
 look at it.

----------------------------------------------------------------------

Comment By: Tom Musgrove (letterrip)
Date: 2007-09-12 11:14

Message:
Doh - forgot to assign it - theeth can you look at this one?

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-08-30 17:24

Message:
Thanks Tom. I'd be interested in finding out in what direction this
 idea can be taken further before I add new patterns. I've also posted on
 bf-committers mailing list.

----------------------------------------------------------------------

Comment By: Tom Musgrove (letterrip)
Date: 2007-07-31 20:08

Message:
Ahmad this looks really interesting.  I'll see if we can get it into a
 branch or if I can find a reviewer for ya

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-07-30 07:20

Message:
NOTE: The texture is now seamless [0, 1] BUT if the rotation or skew is
 applied, the texture won't be seamless left-to-right and top-to-bottom
 even though it appears seamless along its regular axis which gets
 changed due to the transformation.  

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-07-30 07:17

Message:
* Enabled 3D->2D texture mapping functions so that you can use Flat,
 Sphere, Torus and Cube in Map Input panel of Texture Panels.

* In order to give a seamless pattern for the texture, it is made
 seamless in [0, 1] range using the following:
** The Lo and Hi controls for Width are used to generate random numbers
 in the chosen range N. The numbers are then divided by the total sum
 taking into account the Gap H parameter.
** The Lo and Hi controls for Height are used to generate random
 numbers in the chosen range N. The numbers are then divided by the total sum
 taking into account the Gap V parameter.
** This changes the meaning of the above controls. For instance,
 setting Lo=Hi=0.4 for Width and Lo=Hi=0.1 for Height will generate squares if
 N=4 for both Width and Height and rectangles if N=4 for Width and N=4
 for Height.
** Because of this change, a small value for Scale affects the Texture
 Preview but not the texture output during render-time. This has to be
 investigated a bit further.

* Renamed "Tiles 1" to "Interlock 1".


----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-07-18 14:25

Message:
New addition:
* Added 2 colour selection controls for "Base color" and "Gap color".
 The 2 colours are linearly interpolated using the grayscale intensity
 value.
* Added 3 sliders that control variation from the "Base color". The
 variation in hue, saturation and value are applied to each tile/block.
* Added 2 controls "Hi" and "Lo" for random bump intensity per
 tile/block to give more natural appearance to bump map.
* Each sub-tile in a tiling preset supports the random bumps and colour
 variations. The code uses values of neighbouring tiles and does a
 uniform weighted average. Seamless sections of belonging to neighbouring
 tiles also have seamless intensity and colour so there are no harsh
 transitions in colour and bump intensity.

Screenshots:
http://ahmad.wizardproductions.org/blender/texture_plugins/tiles_colours.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/tiles_colours1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/tiles_colours2.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/tiles_randombump2.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/tiles_randombump1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/tiles_randombump3.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/honeycomb_random1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/honeycomb_random2.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/weave_random1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/weave_random2.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/herringbone_random1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/herringbone_random2.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/tile1_random1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/tile1_random2.jpg

Patch files:
*  tilestexture_svndiff5.patch using "svn diff"
*  tilestexture_msysdiff5.patch using diff from msys
distribution
for mingw.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-07-12 23:28

Message:
New addition:
* Weave preset allows generation of seamless weave pattern consisting
 of a horizontal brick pattern interwoven with a vertical brick pattern.
 This also allows generation of diamond plating by setting the corner
 style to Straight and corner size to 0.5. Also, by choosing random widths
 and heights, more interesting weave patterns can be achieved without
 having to mess around with multiple texture slots.

Screenshots:
http://ahmad.wizardproductions.org/blender/texture_plugins/weavepreset1.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/weavepreset2.jpg
 http://ahmad.wizardproductions.org/blender/texture_plugins/weavepreset3.jpg
 http://ahmad.wizardproductions.org/blender/texture_plugins/weavepreset4.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/weavepreset5.jpg
 http://ahmad.wizardproductions.org/blender/texture_plugins/weavepreset6.jpg
http://ahmad.wizardproductions.org/blender/texture_plugins/weavepreset7.jpg

Patch files:
*  tilestexture_svndiff4.patch using "svn diff"
*  tilestexture_msysdiff4.patch using diff from msys distribution
for mingw.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-07-10 12:33

Message:
New additions:
* 3 new presets to generate herringbone patterns. The underlying code
 uses a function to generate a seamless pattern in each block. Given n,
* Enabled corner styles for all presets except herringbone which is
 much more complicated to considering the irregular nature of the seamless
 pattern of irregular hexagons.

Patch files:
*  tilestexture_svndiff3.patch using "svn diff"
*  tilestexture_msysdiff3.patch using diff from msys distribution for
 mingw.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-06-26 22:43

Message:
1. New parameters added: Bevel Option and Strength.
2. Added ability to use random heights for rows similar to random
 widths.
3. Organized parameters in 2 panels: Tiles Basic and Tiles Advanced.
3. Two new tiling presets added: Tiles 1 and Honeycomb

The Bevel Option menu allows following 3 choices:
* Default: Whatever it did up until now for the bevel. All tiles will
 not have the same slope; it is dependent on each tiles' width and
 height.
* Uniform Min: Uses the minimum dimension of all the tiles. You will
 notice in the screen shot that at 0.5 Default causes the bevel to
 converge for smaller/thinner tiles whereas Uniform Min won't and that all
 tiles will have the same slope for the bevels.
* Uniform Max: Same as uniform min except it uses the maximum dimension
 of all the tiles. This will probably make the bevel converge for all
 tiles.

The Bevel Strength control (3rd column, 2nd row) scales and centers the
 intensity in the [0, 1] range. It seems to behave like the "Nor"
 setting however it may prove useful for colour variations later on. I'm
 leaving it in for now.

The "Tiles 1" preset divides each tile/block into one rectangle and 2
 squares. This pattern rotates 90 degrees depending on the count of tiles
 along the horizontal. It will do repeat 360 degrees every 4 tiles. See
 this post for screenshots
 http://blenderartists.org/forum/showpost.php?p=891404&postcount=116 

The "Honeycomb" preset uses a hexagonal lollipop pattern to define a
 seamless web/honeycomb structure. It assumes that Shifting will not be
 used otherwise the pattern degenerates. However, regular and irregular
 hexagonal shapes are tightly linked in a web-like or honeycomb pattern.
 See this post for screenshots:
 http://blenderartists.org/forum/showpost.php?p=899184&postcount=145

Patch files:
*  tilestexture_svndiff2.patch using "svn diff"
*  tilestexture_msysdiff2.patch using diff from msys distribution for
 mingw.


----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-06-21 07:56

Message:
Example blend file updated
* tile_examples1.blend

You could re-open tile_examples.blend and just reset the height
 parameters to 0.1! Anyway, I reworked the examples so they don't use the
 Texture offsets from the Material buttons; they are set to defaults now. The
 new Offset controls in the texture parameters were used to align
 textures for the herringbone patterns (Layers 1 - 3). The brick example
 (Layer 4) uses random heights and random widths. The nodes example (Layer
 5) uses nodes entirely to align the brick patterns to form a complex
 tile and then use the result as a mask to apply a marble texture.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-06-20 23:12

Message:
I've re-arranged the controls to make it more intuitive. See
 screenshot:
http://ahmad.wizardproductions.org/blender/texture_plugins/tiles_layout.jpg

New additions:
* Min/Max/Count controls for the height. So now you can generate tiles
 with random height for the number of rows specified. The random pattern
 repeats vertically (just like the width controls).
* Offset H/V: These will do a horizontal and vertical offset. I found
 it was difficult to align the two textures using the Texture panels in
 the Material buttons window. Since we already do scaling and rotation,
 the offset control was necessary.
* Preset menu with the choices: None, Tiles 1 and Honeycomb. 
* The Tiles 1 preset creates a pattern of 3 interlocking rectangles
 that rotate 90 degrees every tile along the horizontal.
* The Honeycomb preset creates a tight interlocking hexagonal tile
 pattern by using a Y-shaped pattern for each tile. It also adjusts the
 parameters automatically to give proper results.
* The None preset allows generation of patterns as before.

Also, here's a preview of what the "honeycomb" pattern looks like when
 random heights are used:
http://ahmad.wizardproductions.org/blender/texture_plugins/honeycomb_stretched.jpg

Patch files:
*  tilestexture_svndiff.patch using "svn diff"
*  tilestexture_msysdiff.patch using diff from msys distribution for
 mingw.

NOTE: When this patch is applied, the supplied blend file will not load
 the saved texture data properly as new parameters were added.

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-06-14 13:56

Message:
Sorry. The #define had to go before #include <math.h>!

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-06-14 13:18

Message:
- Fixed variable declaration in tiles_rect_func2().
- Added #define for MSVC.

Again, I'm submitting 2 patch files:
  tilestexture_svndiff.patch
  tilestexture_msysdiff.patch

----------------------------------------------------------------------

Comment By: Guillaume Lecocq (lguillaume)
Date: 2007-06-14 11:28

Message:
Hello I try to use your patch on windows, but it failed :
On MSVC you can't declare variable inside code :
 source\blender\render\intern\source\texture.c(858) float d must be declared under the
 function static float tiles_rect_func2(float x, float y, float w, float h,
 float b, float sx, float sy)

I have another error with M_2_PI, MSVC knows this variable only if we
 define _USE_MATH_DEFINES before including math.h
I add before the include:
#ifdef WIN32
#define _USE_MATH_DEFINES
#endif

After this change, compilation works fine

----------------------------------------------------------------------

Comment By: Ahmad Kabani (wizard)
Date: 2007-06-14 11:08

Message:
I had trouble re-applying the tilestexture.patch on Windows XP with
 GnuWin32's version of patch.exe. I made another patch with "svn diff
 --diff-cmd diff.exe". The diff.exe came with the MSYS distrution for MinGW.
 So in case anyone is having trouble use tilestexture2.patch.

----------------------------------------------------------------------

You can respond by visiting: 
http://projects.blender.org/tracker/?func=detail&atid=127&aid=6842&group_id=9





      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


More information about the Bf-committers mailing list