Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27

Thread: I don't suppose anyone knows how to generate bump vectors for simplex noise...?

  1. #16
    eye kan kode gud jrandom's Avatar
    Join Date
    Dec 2009
    Location
    Seattle, WA
    Posts
    1,143
    There's no simple path to node coding. I read through the SDK docs, but the most helpful thing to study was the specular highlight node sample code in the SDK. Even with that, there was a lot of trial-and-error involved. I never would have got it to work had it not been the help of others in this forum.

    My plug-ins come with source code, so you can study that if you like. I never did find any good tutorials.
    Last edited by jrandom; 05-08-2013 at 10:53 AM.

  2. #17
    Thanks a lot jrandom! I'll look into those shaders of yours.

    The only link to a node coding tutorials I could find was dead (Aurorafx) ;-(

    Well, I guess I'll have to see how it goes and come back here if I fail :-)

    Cheers,

    Tom

  3. #18
    creacon
    Join Date
    Nov 2005
    Location
    Belgium
    Posts
    1,299
    I started from the same example, and once you see how you handle nodes the inputs etc, it is quite easy and productive, we bought your aon textures a long time ago for Messiah, looking forward to seeing them ported :-)

    creacon

  4. #19
    creacon
    Join Date
    Nov 2005
    Location
    Belgium
    Posts
    1,299
    Didn't know that you put the source available for others, thanks for that. I don't have any need for anything in particular but it's alaways great to learn from other people's code to improve my own.

    creacon

  5. #20
    Hey creacon!

    Nice to hear there are still some of the old AoN:messiah users around ;-)

    I developed some nice new stuff for Mental Ray and Arnold in the meantime and I miss some options in the LW nodes so I'll see how it goes.

    Cheers!

    Tom

  6. #21
    eye kan kode gud jrandom's Avatar
    Join Date
    Dec 2009
    Location
    Seattle, WA
    Posts
    1,143
    Thomas -- oh heck, you're a real shader coder?? Cool.

    So uh... I don't suppose you have any good advice on generating bump vectors from multiple samples (forum discussion thread), do you? After getting the regular single-sample simplex bump vector generation to work, I realized I also need the more flexible (but slower) multi-sampling bump generation, but have no idea how to calculate good epsilon offsets that aren't going to break at very small or very large scales.

  7. #22
    Heheheh - well, not as "real" as you may hope ;-)

    I got the impression that you are way beyond me when it comes to actual coding - I'm pretty much still a C guy with only little C++ knowledge. I can hardly follow you guys here when you are talking the wonders of C++ 11 :-)

    But I managed to compile the Specular Node example with VC++ Express 2012 today as 64 Bit dll, so I'm rather happy.

    As far as your question goes:
    In Mental Ray, this value is often user setable, since sometimes it's beneficial to be able to select the value depending on what kind of texture you use or what look you want.
    Otherwise I think you could take some portion of the "spotsize" (if that concept exists in LW?). Since this gives you a value related to the currently sampled spot.

    I read your thread about this and wondered if the internal result from the simplex noise couldn't be used directly for speeds sake.
    You want to use the LW "Functions", right?
    Couldn't you "bend" those normals with the function curve (sorry, don't know yet how those things work in LW, I just started today to look into this)?
    What the functions should do (I guess) is that instead of a linear interpolation between the two maxima - perpendicular to the surface and "laying flat" on the surface - the curve is used.
    So if you assume that the extremes stay unchanged and only the values in between are changed (like a photoshop curve with fixed black and white point) you could use a dot product to find a zero to 1 value between the surface normal and your bump vector from the noise. That value would be the input into the function curve. The result of the function curve (not sure how you get that delivered?) would then tell you how much you have to bend the vector up or down, keeping it's (surface local) x and z direction as is.

    Hm - does that make any sense? I need to re-learn about those concepts in LW first to know the right syntax ;-)
    And I'm not sure if I understood the problem right.

    Cheers,

    Tom

  8. #23
    eye kan kode gud jrandom's Avatar
    Join Date
    Dec 2009
    Location
    Seattle, WA
    Posts
    1,143
    Quote Originally Posted by Thomas Helzle View Post
    Heheheh - well, not as "real" as you may hope ;-)

    I got the impression that you are way beyond me when it comes to actual coding - I'm pretty much still a C guy with only little C++ knowledge. I can hardly follow you guys here when you are talking the wonders of C++ 11 :-)
    Oooh! You're in for a fun time, once Microsoft gets their C++11 compiler up to spec. I used to be a dyed-in-the-wool C coder, but after I wound up implementing a full object system in C99 I realized it would just be cleaner and easier to use C++. C++11 is like a whole new world and I can't recommend it enough.

    A good example would be the NodeBase.h template object in my node plugin source code. It saves me having to repeat a bunch of boilerplate in getting the callbacks set up, while still giving me the ability to override the behavior of any particular callback on a node-by-node basis.


    In Mental Ray, this value is often user setable, since sometimes it's beneficial to be able to select the value depending on what kind of texture you use or what look you want.
    Otherwise I think you could take some portion of the "spotsize" (if that concept exists in LW?). Since this gives you a value related to the currently sampled spot.
    Ah, but that could potentially miss small-scale detail that's smaller than the spot size, right? Wouldn't that result in bump artifacts?

    Right now I'm trying to find a good small value that will handle the widest range of scene scale before hitting precision limits. (For instance, if I use a really tiny number like 0.0000001, or 1/1000 of a millimeter and then model a planet at full scale using bump maps, there's a good chance that the offset value will truncate to 0.0 and the bumps would simply not appear.) I'm very curious as to what the Lightwave noise nodes use -- is it a constant or do they dynamically generate the offset somehow. No idea.


    I read your thread about this and wondered if the internal result from the simplex noise couldn't be used directly for speeds sake.
    Yep, got that. I've renamed the output to "Fast Bump", and the others will be "Bump from Alpha" (uses alpha channel directly -- my noise node allows for incoming foreground and background alpha input), and "Bump from Noise" which will be just like "Fast Bump" only done via multi-sampling instead of using the directly-generated simplex bump gradient -- allowing me to apply Function and Contrast.


    You want to use the LW "Functions", right?
    Couldn't you "bend" those normals with the function curve (sorry, don't know yet how those things work in LW, I just started today to look into this)?
    What the functions should do (I guess) is that instead of a linear interpolation between the two maxima - perpendicular to the surface and "laying flat" on the surface - the curve is used.
    I couldn't figure out a way to do this that gave correct results. I tried many experiments, but if it's possible then the math is just over my head. My initial impression is that it's not possible -- Function and Contrast alter the intensity of points and it seems that the only way to appropriately alter the bump map to mirror this is to multi-sample the noise after Function and Contrast have been applied so the proper gradient can be calculated.

    The bump vector doesn't actually encode a direction vector, it holds XYZ rates of change (from -1 to 1). I'm kind of embarrassed it took me so long to figure that out.
    Last edited by jrandom; 05-08-2013 at 12:14 PM.

  9. #24
    Well, the SDK example is in C, my existing code is in C, so I fear I'll stick with it for the moment ;-)


    Smaller than the spot size means "invisible", no? Or giving the AA a really really hard time with sub-pixel-bump - usually not a good idea ;-)
    I would think that something like half or a quarter of the spot size (is that one or three values in LW?) in each direction should do just fine. Try it out I'd say ;-)

    I understand, if you have additional internal functions that also change the noise it will get pretty complicated to rebuild that as a vector offset - probably not worth it as you say.


    LW seems to have it's own way of doing things compared to messiah, Mental Ray and Arnold - I'll have to see if I'll make it through - I'm easily discouraged in that regard.

    Cheers,

    Tom

  10. #25
    eye kan kode gud jrandom's Avatar
    Join Date
    Dec 2009
    Location
    Seattle, WA
    Posts
    1,143
    I'll give the "half of spot size" a shot, although I'm not entirely sure how to handle glancing angles. LW provides a "cosine" value in the spot info I can use to determine how accurate the given spot size is, but when the size is "inaccurate", I'm not sure how I should calculate my offset. I'll try some experiments and see how they work out.

    Hey, the original version of my optimizer plugins were written in C99, so if you go back to my LW Plugin page and go to the bottom of the post, the old one is still available and also includes full source. Granted, Microsoft doesn't support C99 so you won't be able to compile it directly, but it should give you a starter framework on one possible way to structure your C code for Lightwave.
    Last edited by jrandom; 05-08-2013 at 01:48 PM.

  11. #26
    Thanks, I'll check it out.
    Right now I'm in the "overwhelmed" phase trying to grok what is what ;-)

    Cheers,

    Tom

  12. #27
    eye kan kode gud jrandom's Avatar
    Join Date
    Dec 2009
    Location
    Seattle, WA
    Posts
    1,143
    Yeah, it's a bit of a learning curve. Whenever you hit something you can't figure out, ask around here.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •