Randomness in arrays - first attempt #38527

Closed
opened 2014-02-06 20:48:00 +01:00 by Patrice Bertrand · 7 comments

{F76260}Hello, this patch is a first attempt at adding a "noise" or "randomness" option in the array modifier.
Some discussion regarding this attempt can be found here: http://lists.blender.org/pipermail/bf-committers/2014-February/042760.html

I am posting this just to get some feedback, since this is my very first work on Blender code. I only include the Mod_array.c diff, since this is where all significant processing takes place. As you will notice, the loop acting on vertices was left untouched, so that the overhead as per the original array modifier is very low.

The feature works, including when mixed with other modifiers.. For the moment I made it simple, with just 3 parameters: add_noise is a boolean, included in amd-> flags, that is true when noise option has been requested, amd->noise_seed is an integer seed that is fed to RNG, and amd->noise_amplitude is a float that defines the range of the random translation. It would be very easy to add more customization, such as defining amplitude on the x, y and z axis and similarly adding rotation on each axis.

But, as I said in the comment referenced above, it appeared to me that a noise modifier would be a better approach, that could be used in a more flexible way on top of a number of array modifiers. The noise modifier would act on loose parts, keeping each loose part as it is and applying random, customizable, translation and rotation.

{[F76260](https://archive.blender.org/developer/F76260/array_noise.diff)}Hello, this patch is a first attempt at adding a "noise" or "randomness" option in the array modifier. Some discussion regarding this attempt can be found here: http://lists.blender.org/pipermail/bf-committers/2014-February/042760.html I am posting this just to get some feedback, since this is my very first work on Blender code. I only include the Mod_array.c diff, since this is where all significant processing takes place. As you will notice, the loop acting on vertices was left untouched, so that the overhead as per the original array modifier is very low. The feature works, including when mixed with other modifiers.. For the moment I made it simple, with just 3 parameters: add_noise is a boolean, included in amd-> flags, that is true when noise option has been requested, amd->noise_seed is an integer seed that is fed to RNG, and amd->noise_amplitude is a float that defines the range of the random translation. It would be very easy to add more customization, such as defining amplitude on the x, y and z axis and similarly adding rotation on each axis. But, as I said in the comment referenced above, it appeared to me that a noise modifier would be a better approach, that could be used in a more flexible way on top of a number of array modifiers. The noise modifier would act on loose parts, keeping each loose part as it is and applying random, customizable, translation and rotation.

Changed status to: 'Open'

Changed status to: 'Open'
Patrice Bertrand self-assigned this 2014-02-06 20:48:00 +01:00

Added subscriber: @PatriceBertrand

Added subscriber: @PatriceBertrand

Added subscriber: @WarrenBahler

Added subscriber: @WarrenBahler

I don't have a build environment set up to test, but this is a feature I've though should be implemented for a while.

I think a simple 1 dimension random transform is sufficient for most cases;if the user needs more randomness he could add the array to a simple plane or empty and use dupli objects with a group to achieve a lot of variation.

or perhaps a "Dupligroup" option could be added directly to the modifier.

for example an array of empties could be assigned a dupli group which would instance a random object from the group; along with a random offset and transform this would be very powerful.
but that may be outside the scope of the array modifier?

I don't have a build environment set up to test, but this is a feature I've though should be implemented for a while. I think a simple 1 dimension random transform is sufficient for most cases;if the user needs more randomness he could add the array to a simple plane or empty and use dupli objects with a group to achieve a lot of variation. or perhaps a "Dupligroup" option could be added directly to the modifier. for example an array of empties could be assigned a dupli group which would instance a random object from the group; along with a random offset and transform this would be very powerful. but that may be outside the scope of the array modifier?

Thank you for your feedback.

Testing the feature at this point could be a waste of time, I was posting the patch to get some feedback on coding strategy and design from experienced developpers.
I am not familiar with dupli-xxx stuff, will look into it.
It seems to me the case of 2 dimensional arrays is really important, and really handled too poorly by my original approach, ie acting at the array modifier level. The second array modifier takes the output of the first as a whole, so it is impossible to add randomness to individual instances in the second line of the array, which really spoils it all. Here are 2 images that tell it all : The first one is a single array with random translation applied to each instance. The second image is what happens when adding the second dimension: the second line of items is a copy of the fist line, with random translation applied to the whole line.

So I am working on another approach, that will act after array modifiers, or after whatever other modifier, which will be more flexible and give far more control. Acting after array modifiers means you don't have the original object's mesh anymore, all you have is the derived mesh handed to you by previous modifiers. So I am trying to act on loose parts, which in many cases but not all, will be the original object.

Indeed, yet another approach would be to make up an array of empty, of 1, 2 or 3 dimensions, and then have a modifier that duplicates objects centered on each of these empties, each object having a random variation (translation / rotation / scale) applied to it. This would be quite flexible also. I might give it a try.

Thank you for your feedback. Testing the feature at this point could be a waste of time, I was posting the patch to get some feedback on coding strategy and design from experienced developpers. I am not familiar with dupli-xxx stuff, will look into it. It seems to me the case of 2 dimensional arrays is really important, and really handled too poorly by my original approach, ie acting at the array modifier level. The second array modifier takes the output of the first _as a whole_, so it is impossible to add randomness to individual instances in the second line of the array, which really spoils it all. [Here are 2 images that tell it all ](https://hubic.com/home/pub/?ruid=aHR0cHM6Ly9sYjEuaHViaWMub3ZoLm5ldC92MS9BVVRIX2E0ZjZlZjkxZDM0N2RiYmViNzEyNjJlZTk3M2EzNWU5L2RlZmF1bHQvLm92aFB1Yi8xMzkyMTA5NzA1XzEzOTQ3MDE3MDU/dGVtcF91cmxfc2lnPTgxMWUzZTQzMTIyNWY5ZGNmMjhjZGEwNDZlMjY2M2U1ZjlhYmJjZDQmdGVtcF91cmxfZXhwaXJlcz0xMzk0NzAxNzA1#): The first one is a single array with random translation applied to each instance. The second image is what happens when adding the second dimension: the second line of items is a copy of the fist line, with random translation applied to the whole line. So I am working on another approach, that will act _after_ array modifiers, or after whatever other modifier, which will be more flexible and give far more control. Acting after array modifiers means you don't have the original object's mesh anymore, all you have is the derived mesh handed to you by previous modifiers. So I am trying to act on loose parts, which in many cases but not all, will be the original object. Indeed, yet another approach would be to make up an array of empty, of 1, 2 or 3 dimensions, and then have a modifier that duplicates objects centered on each of these empties, each object having a random variation (translation / rotation / scale) applied to it. This would be quite flexible also. I might give it a try.

I have chosen to implement this as "noise modifier", of which I just submitted the patch. So this is closed.

I have chosen to implement this as "noise modifier", of which I just submitted the patch. So this is closed.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#38527
No description provided.