Corner Dirt

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 04 April 2013   #1
Corner Dirt

The idea here is to create at tool that allows artists to easily place a selection of objects randomly along the edges of faces to quickly place dirt and garbage.



My process for creation:
1. The user would define a collection of objects they wanted duplicated everywhere.
2. The user would then define the object in which they would want the collection distributed.
3. The script:
A. Find all faces who have an average normal facing Z+
B. Find adjacent faces and test them to see if they are within the angle threshold
C. Starting from the shared edge going outward place the objects

Feel free to shed light or jump in and share snippets anyone.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com

Last edited by JokerMartini : 04 April 2013 at 01:10 AM.
 
Old 04 April 2013   #2
Start:
Below is a snippet that collects the faces who's normal faces Z+ but within a given threshold.

What would be a good way to attack the next step. Compare the collected faces against all the remaining faces, collecting all those faces who fall within an angle threshold?


(
	struct faceData (index , normal)
	
	ground = $ground
	numFaces = ground.numfaces
	upMin = .7 -- min value of 0.0
	upMax = 1.0 --max value of 1.0
	facesArr = #() --the faces that fall within the defined threshold values
	clearlistener()
	
	for f = 1 to numFaces do
	(
		faceNormal = polyop.getFaceNormal ground f
		if faceNormal.z >= upMin AND faceNormal.z <= upMax do append facesArr (faceData index:f normal:faceNormal) 
	)
)
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #3
Slight update/change
I decided to collect all the faces and add the struct to keep the information for each face because I'm assuming I'm going to be need this information down the road anyways.

(
	struct faceData (index , normal, upZ=false)
	
	ground = $ground
	numFaces = ground.numfaces
	upMin = .7 -- min value of 0.0
	upMax = 1.0 --max value of 1.0
	facesArr = #() --the faces that fall within the defined threshold values
	clearlistener()
	
	for f = 1 to numFaces do
	(
		faceNormal = polyop.getFaceNormal ground f
		pass = if faceNormal.z >= upMin AND faceNormal.z <= upMax then true else false 
		append facesArr (faceData index:f normal:faceNormal upZ:pass) 
	)
	print facesArr
)
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #4
Whats a good way to find neighboring faces based on a face Integer, rather than doing the selec then > grow selection since that method and process would be insanely slow on dense geo.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #5
Originally Posted by JokerMartini: Whats a good way to find neighboring faces based on a face Integer, rather than doing the selec then > grow selection since that method and process would be insanely slow on dense geo.

wait... it was discussed many times here. i've posted a benchmarking...
getfacesusingvert (getvertsusingface) ...
 
Old 04 April 2013   #6
Originally Posted by JokerMartini: My process for creation:
...
3. The script:
A. Find all faces who have an average normal facing Z+
B. Find adjacent faces and test them to see if they are within the angle threshold
C. Starting from the shared edge going outward place the objects

see my comment in the thread about 'wishes'
the 'faces flatness' is a secondary condition. you have to find first a way to calculate and define the value of a vertex convexity.
 
Old 04 April 2013   #7
Originally Posted by denisT: see my comment in the thread about 'wishes'
the 'faces flatness' is a secondary condition. you have to find first a way to calculate and define the value of a vertex convexity.

Why do you have to find that first.

I was going to take the faces collected that face z+ then compare those faces to the remaining ones . By compared the angle between face to face and then collect the shared edge between the faces whose angle meets the required threshold. ......this process not correct.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #8
How about first getting all concave edges that are somewhat parallel to the XY plane, then test their faces for orientation.
__________________
The GPU revolution will not be rasterized! - http://www.jdbgraphics.nl
 
Old 04 April 2013   #9
What would you be testing and collecting when calculating convexity
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #10
Originally Posted by JokerMartini: What would you be testing and collecting when calculating convexity


Talking about dirt or ambient occlusion, the narrower the angle between faces is, the more you will have ambiant occlusion/dirt in the corner.

I think that's what DenisT was talking about because his tool might be design to auto-paint vertex ambient occlusion (I was sure to have seen a post about that in that thread and can't find it anymore...).

Your tool seems to be more designed to auto position props on a ground. Convexity here will be used to figure out if the neighbour face is a wall or a steep ground (according to a given angle).

Btw, I am surprised that such a placement tool does not exist already...
 
Old 04 April 2013   #11
Originally Posted by feranti: Talking about dirt or ambient occlusion, the narrower the angle between faces is, the more you will have ambiant occlusion/dirt in the corner.

I think that's what DenisT was talking about because his tool might be design to auto-paint vertex ambient occlusion (I was sure to have seen a post about that in that thread and can't find it anymore...).

Your tool seems to be more designed to auto position props on a ground. Convexity here will be used to figure out if the neighbour face is a wall or a steep ground (according to a given angle).

Btw, I am surprised that such a placement tool does not exist already...


I couldn't agree more. I am surprised there isn't one to.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com

Last edited by JokerMartini : 04 April 2013 at 05:37 PM.
 
Old 04 April 2013   #12
Moving forward with this project, what would it be a good process? Just looping through each edge of the mesh, getting the polygon's that use that edge? Then compared the angle difference between the faces? Or would that not work that way?

I'm just trying to figure out the next step, which I know is the calculating the convexity, but I'm not sure exactly goes into that or what direction to start
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #13
Quote: Btw, I am surprised that such a placement tool does not exist already...


it does, rtt an ambient occlusion map (scanline/mentalray/there was a free edge render material plugin) and use it as the distribution material in a particle flow position object.
 
Old 04 April 2013   #14
to round trip an ambient occlusion map every time there is a change would be very taxing and not very user friendly, I do agree it is a method to use, but not one I prefer
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #15
use vertex colouring then, when you change the distribution object just colour the verts to get the distribution you want particle flow adds the randomness. you could even use the very old mxs script pits and peaks to do the shading.

it's actually really sweet particle flow updates in real time as you adjust the vertex colours

Last edited by Klunk : 04 April 2013 at 10:06 PM.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:50 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.