Planetside Software Forums

General => Terragen Discussion => Topic started by: TheBadger on September 06, 2012, 12:35:46 AM

Title: (IT WORKS!!) rotate & scale shaders with-in an object. (update)
Post by: TheBadger on September 06, 2012, 12:35:46 AM
Hello.

Can someone tell me if there is a way to effect rotation and scale of a shader within an object?

To be clear, I am asking how I can affect the XYZ for rotation and scale of a single shader with-in an object node. While not effecting any other part of the object.

To visualize the problem:
Say you have a 2 rings. One smaller than the other. the smaller ring is placed inside the empty center of the larger ring.
Now imagine that you want to rotate the inner ring and change its scale too. *Please just except that the two rings must be one object, where each ring is its own shader with-in the object.

Thank you.
Title: Re: rotate & scale shaders with-in an object.
Post by: TheBadger on September 06, 2012, 02:13:38 AM
Ok, it appears to me that I can rotate and scale a texture on any part of a model by using a translate node. But It does not appear possible at all to do the same to the shader its self. Is this correct, or have I missed something?
Title: Re: rotate & scale shaders with-in an object.
Post by: Dune on September 06, 2012, 03:05:58 AM
I'm afraid I don't understand what you're getting at  :-[ If you scale/rotate a texture, that IS the shader, isn't it?
Title: Re: rotate & scale shaders with-in an object.
Post by: bigben on September 06, 2012, 03:09:24 AM
The transform shader appears to have no effect on image map nodes using spherical projection.
For objects it would be most sensible to have them mapped  to UV, and this mapping will (should?) overrirde any other transformations to the image map.

If the image your using as a texture is rectangular you could simulate rotation by editing the image with an offset in the direction of rotation but there are lots of IFs associated with that as to whether it will do what you want or not.
Title: Re: rotate & scale shaders with-in an object.
Post by: j meyer on September 06, 2012, 10:54:22 AM
Quote from: TheBadger on September 06, 2012, 12:35:46 AM
Now imagine that you want to rotate the inner ring and change its scale too. *Please just except that the two rings must be one object, where each ring is its own shader with-in the object.

As far as I know this is not possible in TG2.The only way I can think of would be
an obj sequence.
Title: Re: rotate & scale shaders with-in an object.
Post by: dandelO on September 06, 2012, 11:26:58 AM
To have free rule over your textures inside a model, create a 'transform shader' and select 'use world-space, final position'.
Now you can position/rotate/scale any shader that allows transforms.
I did a lot of this for the recent beehive models (http://www.planetside.co.uk/forums/index.php?topic=14958.msg145688#msg145688). All the wood shaders are fractal and I was able to transform them all to the correct orientations and positions to match each object part. You can transform a spherical plan image map, too, just use the transform shader for all transforms, leaving the image map shader's transform parameters at '0'.
Title: Re: rotate & scale shaders with-in an object.
Post by: bigben on September 06, 2012, 11:45:54 AM
Thanks dandelo, very helpful info.
Title: Re: rotate & scale shaders with-in an object.
Post by: TheBadger on September 06, 2012, 01:44:19 PM
Thanks martin.

Before you sent some help. I had rendered out the following animation. It was uploading just as I heard back from you.

The animation the way I did it, did not work. As I am sure you all would expect. However there is some interesting things happening.
While I did not get the texture shader to move with the transform shader (the way I had it set up) The light from the shader is moving as if the texture were also. its strange.
https://vimeo.com/48963732

Anyway I will try what DandelO gave me. And see how far I can get.

Title: Re: rotate & scale shaders with-in an object.
Post by: TheBadger on September 06, 2012, 05:50:52 PM
Quote from: Dune on September 06, 2012, 03:05:58 AM
I'm afraid I don't understand what you're getting at  :-[ If you scale/rotate a texture, that IS the shader, isn't it?

Hey Ulco,

You got me a little confused now. In the shader they look like there all one. But I know that the object is independent from the texture since even in TG2 I can change that. The object is the same regardless of what texture I put on it. So I don't know now.

I had thought that because the object is separated from the texture, regardless of mapping (I don't want to change the mapping! just the part of the texture that is with-in the map- over time) that I should be able to make some effects.

I realize that the object is the object. Meaning the control panel in the objects tab is where I can control the position and scale of the object.
But with-in the objects node. In the parts shaders. I wanted to effect change to the texture.

I think it is still possible. I may not be able to do exactly what I wanted, but something should happen. Unless staff chimes in saying they know for sure that I cant do anything like I want, then Ill keep trying.
Title: Re: rotate & scale shaders with-in an object.
Post by: TheBadger on September 06, 2012, 05:53:06 PM
oops
Title: Re: rotate & scale shaders with-in an object.
Post by: TheBadger on September 06, 2012, 08:26:39 PM
QuoteTo have free rule over your textures inside a model, create a 'transform shader' and select 'use world-space, final position'.
Now you can position/rotate/scale any shader that allows transforms.

Martin, Can you please expand on this. I have been trying to make this work. But its not showing any effect. If it will work, its not by the way Im doing it.
Where are you plugging in your transform shader at? I would have thought that it would be the shader in question see below,
Hope you have your red pen handy.


I did try the file you sent. I think from that the power fractal is the best option since I could see a difference from seed changes. I''ll test an animation with that next. I also liked the effect from a simple shape shader, though I could not see a way to make changes in the effects appearance over time.
And rotating the simple shape shader its self is good, but it looks the same from every angle. Perhaps I could apply the simple shape to the image map of the texture (not the primary) and than a transform on top of that? not sure if there will be any visual effect though.
Title: Re: rotate & scale shaders with-in an object.
Post by: dandelO on September 06, 2012, 09:20:39 PM
Assuming 'inner shader_1' is what you are trying to transform, you'll need to take the output of 'Inner shader_1', plug it into the transform shader's right-hand input and then the transform shader plugs into the object part 'inner_1'. Just leave the left-hand input empty on the transform shader.

I can't see what you are trying to move here as there is nothing feeding any of the 'inner shader_1' inputs. Unless you have image maps assigned in the settings? I'm don't think you can transform images assigned to object UV's but I know you can move around other projection types. I'd rather not load the images in the default shader but import a new image map shader and use it from there(much more options for image map shaders than there are for images loaded in a default shader). Plug the image map shader into the default shader's luminosity function and then finally the transform node into the object part.

If it doesn't have images loaded and the 'inner shader_1' node just has a simple flat colour you won't see any effect from the transform shader as it's just going to move the solid colour to a different area.
Title: Re: rotate & scale shaders with-in an object.
Post by: dandelO on September 06, 2012, 09:44:01 PM
I'd set it up something like this image.

[attachimg=1]

As long as the 'inner shader_1' has something to take some function values from(the image map shader in this case, but it could be any number of other shaders), then you should be able to shift the lot around easily before it goes into the object part.
Title: Re: rotate & scale shaders with-in an object.
Post by: TheBadger on September 07, 2012, 01:27:59 PM
No joy Martin.

This is strange.
I got the sub surface scatter effect to work. I can make an object look like it has a semi transparent skin, and I can make it look like there is something beneath the skin. But animating one of the layers is not so simple.

At this point I would like to ask you if I can send you the files and textures to take a look at? I realize you have your own projects and work, but I think that I will not get any further on this on my own, or even with this tread. You will have to have the files to know for sure yourself.

Please PM. your email if you would like to take a look at the files. I am not sure I still have the address.
If you don't have time don't feel bad to tell me no.

Cheers.
Title: Re: (IT WORKS!!) rotate & scale shaders with-in an object. (update)
Post by: TheBadger on September 08, 2012, 05:23:50 PM
Hi.

After DandelO got his hands on the files a solution was found. It works very well by the way!
All Hail DandelO! Or see for your selves  ;)

https://vimeo.com/49082546

[attach=1]
Title: Re: (IT WORKS!!) rotate & scale shaders with-in an object. (update)
Post by: bigben on September 08, 2012, 06:03:25 PM
that looks very cool
Title: Re: (IT WORKS!!) rotate & scale shaders with-in an object. (update)
Post by: Dune on September 09, 2012, 03:30:07 AM
Finally I understand what you're trying to do, Ty, but is it an object within a slightly larger similar object or a double sided object, where you texture the outer and inner side separately? If that is the case, it's a very interesting result. In your animation, though, I can see an inner sphere a bit smaller, is that right? 

I don't know if this is any use in the light of your experiments, Ty...
Title: Re: (IT WORKS!!) rotate & scale shaders with-in an object. (update)
Post by: TheBadger on September 09, 2012, 07:32:30 PM
Hi Dune,

It is one object with two parts. An outer sphere and an inner. The inner sphere is slightly smaller. They are both the same in every other way. Each is textured with the same image.
It needs to be one object and not two because there will be more than one object showing this idea in a scene.
And placing a bunch of objects, and then placing more inside the first set would be trouble.
I will check out your files^^ soon. They look interesting.


Ben,
Thank you.
Title: Re: (IT WORKS!!) rotate & scale shaders with-in an object. (update)
Post by: Dune on September 10, 2012, 02:29:14 AM
You'd probably get in trouble if you make a complicated object and a slightly smaller copy inside; it'll cross a certain points. I thought you used the 'doublesidedness' of an object to color the inside different than the outside, using flip normals or something fancy. But if you flip the normals of an exact copy and color that differently from the original object, the first will probably not be seen by the camera, as it's inside out.
Title: Re: (IT WORKS!!) rotate & scale shaders with-in an object. (update)
Post by: dandelO on September 10, 2012, 10:35:53 AM
Transforming textures that use 'object UV' mode does actually work. The textures on multiple parts can all be animated using object space. I didn't think it would work but it does. Very handy. All the animated textures won't cross over or be distorted if they use object space because they will all move relative to the 'part' their assigned to and not in world-space. This means that a model which has multiple parts like this, regardless of their position/rotation, can be controlled with one transform shader. :)

You can also disguise the edge of the inner sphere and make it appear to be pressing towards the outer shell a bit by raising the index of refraction above '1' in the transparency shader.

Here the ior is set to '1.1' and it looks a more snug fit, which is probably a better setting:
[attachimg=1]
Title: Re: (IT WORKS!!) rotate & scale shaders with-in an object. (update)
Post by: TheBadger on September 10, 2012, 04:08:13 PM
Very nice Martin!

I am surprised there is not more interest in this. I thought it was kind of a big deal?
Title: Re: (IT WORKS!!) rotate & scale shaders with-in an object. (update)
Post by: dandelO on September 10, 2012, 05:18:35 PM
Here's a couple of pulsers since there's already a video posted by Badger on page 1. I'll pop these other experiments here too...

[attachimg=1]

[attachimg=2]

Now I'll leave it to Badger to carry on the thread here. I was only helping out with a few texture problems, it's all his doing and should be an extremely nice bit of eye-candy for us all once he's done. :)