Jump to content

¿how can I make two shaders in the same object?


Sailarg
 Share

Recommended Posts

On 9/24/2017 at 12:48 PM, Sailarg said:

I want to do the same, only I thought it was easy to apply the 2 effects to the same object xD

I do not know much about this topic, but a decent (& much faster) way to get a fish eye effect is done the same way as it is done in the real world, the lens.  It is implemented in camera.fov, or focal length.  It is measured in radians in BJS, but also can be in units of millimeters.  The default camera.fov is 0.80 radians.  That corresponds to nothing in the real world, so I have no idea why it got chosen to be that.  Most things default to 35 mm (0.857556 radians) due human vision.  I typically use 120 mm wide angle lens for my scenes ( 0.265103 radians), but a fisheye lens is about 10 - 15 mm(2.02 - 1.64 radians).  I would try doing this first, before doing some expensive post process.

Link to comment
Share on other sites

About same mesh using two it is unfortunately not possible.

Solutions are exactly the already proposed ones:

  1. Post Process
  2. Lens Setup
  3. Create your own shader to apply both lighting + effect (as long as the effect does not needs the several pixels in inputs like in blur)
Link to comment
Share on other sites

First, do an animation of camera.fov the same way you would of any other of that type.  I do not use the BJS animation system.  To go back and forth, a beforerender will possibly work better. 

For a very low focal length, the camera will have to be moved much closer to the subject, but the distortion will be evident as below.  Anything which is closer to the camera than something else will look wildly closer / larger.

fisheye.thumb.jpg.d536a0392fcad9ecb81cbdd57ff8b610.jpg

This means any animation of .fov must not be over too wide a range of values, or the camera distance difference will overpower the distortion.  FYI, I thought of adding a kind of a "flashback" scene transition effect going from fish eye to previous focal length with harp music.  The distance issue stopped me, but did manage to add a "zoom out".  There, I go from about 630 mm to whatever the original focal length was.  Have not published the source yet, but have added "zoom out" onto a test scene of mine which goes through each of my transitions at random: B&W to color, invisible to visible, out of focus to focus, and now also zoom out.  Run this scene over and over till the "zoom out" gets picked as the transition.

On a side note, @Deltakosh or @Sebavan, could I add a setter / getter pair for focalLength?  They would only change / reference fov.  Radians suck.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...