rayman Posted May 6, 2012 Share Posted May 6, 2012 (edited) Hi, there. I`m trying to create displacement shader with uvs offset, so when displacement is applied, the uvs are preserved and did not change in space. What I did so far is to construct prototype using vop sop and it works fine: So I converted it to the shader, but the result is not the same. As you can see there is a small error between displacement and uv offset: And The shader itself The problem is that distortion is not consistent - there is a regions with large displacement, but very small or no errors, and also places with small displacement and large distortions. I really have no idea what is the problem here, so I hope anyone can help. Thanks. disp_uv_test2.hipnc Edited May 6, 2012 by rayman Quote Link to comment Share on other sites More sharing options...
rayman Posted May 6, 2012 Author Share Posted May 6, 2012 I solved it. Rest position is the key, because after displacement, points has different positions. Quote Link to comment Share on other sites More sharing options...
robonilla Posted June 19, 2012 Share Posted June 19, 2012 Excuse me Pavel, I'm glad that you could figure it out that quickly, but would you mind sharing how you did it? I am very interested on learning what you did. I have used the rest position in other occasions but couldn't figure out how to fix these one. Also could you clarify me some (probably basic) questions. I was checking out your VOPs prototype and I couldn't figure out why you have to use a multiplier parameter (I saw in your shader that you use a value of -0.1) An also why do you flip the y and z values when applying the displace to the UV? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
rayman Posted June 21, 2012 Author Share Posted June 21, 2012 (edited) Well, multiplier and reversed y and z values depends entirely on corelation between uv space and object space. So If 1 uv unit is equal to 10 global units, you have to multiply them to match exactly. Also in this scene I wanted to displace on x and z directions, thats why u is connected to x and v to z. For the shader I ended with completley different solution. At first this approach was not bad, but in simulation global space displace is not a good idea (you have to displace each piece in its own space). So I created 3(2 are also ok) vectors per each point and stored them during simulation. Then in shader it was easy to construct matrix for each point and displace them in every direction I want. Maybe this is not the best solution but in my case it was good enough. The tricky part was to guess which parameter(point or vector) is in what space. Some of them are in shader/camera space, others in global, so you have to create convertions to be sure everything works ok. I can share some example scenes if you want to Edited June 21, 2012 by rayman Quote Link to comment Share on other sites More sharing options...
robonilla Posted June 21, 2012 Share Posted June 21, 2012 Hi Pavel! Thanks a LOT for that explanation, I really appreciate it. I guess I have to re-study more in depth all the space concepts and transformations between them if I want to someday be able to write shaders successfully. So in the approach you finally used you are kind of defining a different space for each point to be displaced in? Is it right? But doing that wouldn't you require to have a high-poly count to really get a lot of details? (just like your VOP approach) Am I wrong? I think I kind of get the idea, I'm gonna see if I can figure it out but if its not too much of a problem I would love to see an example whenever you have time. Thanks again Quote Link to comment Share on other sites More sharing options...
rayman Posted June 21, 2012 Author Share Posted June 21, 2012 (edited) Thats right. I have one transformation matrix per each point, so when objects are driven by simulation/dop displacement stays in right space. Think of it as matrix per simulated piece, where each point of that piece has the same matrix. I know that dops have this kind of data per piece, but I`m not expierenced enough to use it. Hi-poly model is not required, because renderman renderers have this step called dicing, where geometry is subdivided into polys with size smaller than 1 pixel. Creating displacement in shader means that attributes are transfered from points to micropolys, and shader is executed per micorpoly, so you have this extra hi-poly detail for free. Edited June 21, 2012 by rayman 1 Quote Link to comment Share on other sites More sharing options...
robonilla Posted June 29, 2012 Share Posted June 29, 2012 Hey Pavel! thanks a lot for that last explanation, I haven't been able to try implementing the matrix per point approach cause I got caught in another project and this was for a personal project so no time now, but just wanted to pass by and thank you for your kind help When I have a bit of time I'll be trying it again. Thanks! Quote Link to comment Share on other sites More sharing options...
akima Posted August 23, 2016 Share Posted August 23, 2016 (edited) voronoi_edge-disp-test-v2.hipncI have the same problem, it works correctly in the vopsop but not in the shaderI did not understand the method to solve the problem, you can go into detail or to capture your shader?Thank you for you precious help! Edited August 23, 2016 by akima update voronoi_edge-disp-test Quote Link to comment Share on other sites More sharing options...
akima Posted August 23, 2016 Share Posted August 23, 2016 i have edited my post for update the file hipnc Quote Link to comment Share on other sites More sharing options...
akima Posted February 4, 2017 Share Posted February 4, 2017 i have a new problem: the uv is good, but the noise displacement change with direction of pieces (yet in shader i have a rest position...) any idea? thanks! edge_displacement_shader3.hipnc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.