Jump to content

Wchris

Members
  • Posts

    281
  • Joined

  • Last visited

Posts posted by Wchris

  1. you either have to do multiple render passes or use a post-processing effect to get true transparency for water.

    Exactly I find this water more transparent and less reflective (no mirror effect) than the current provided one. But I believe he is not using post-processing and no multiple renders.

    You are right the principle is the same, but the settings are different and current waterplane has not enough properties exposed to configure it to look like this (and I get lost tweaking the shader directly).

  2. I had exactly the same questions as you some weeks ago, and also tryed cheapwater.

     

    I ended up trying to fix an old LE3 widget from Shadmar, my result is here http://www.leadwerks.com/werkspace/topic/14778-why-do-i-get-red-water/ but it is still experimental, I'm no shader guru.

     

    But I would prefer and official solution for animated water, because this plugin does not have water physics.

     

    I'm 100% sure Josh can do it, he did it in the past but was not satisfyed by the result. He should not be so perfectionist, 90% of people were happy with the solution he had, many event buyed LE2 because they saw the beach fps demo . Current "flat" mirror waterplane is indeed not realistic at all, water is never flat like a mirror in a game (even if it can be in reality without wind) people just expect it to look "living" and have waves and ripples .

     

    For the newbies this is how it looked like

    in 2009 !!! and why I say he can do it.

     

    Also I feel really scared of doing things wrong when I mod shaders, I would really like the engine to do this job.

    • Upvote 1
  3. If you choose category "shaders" and type "all items" you get 2 pages of shaders.

    But if you click on page 2 or "next page" then category is reset and you will never see page 2 of shaders but page 2 of "all category"

     

    Also, tryed to PM you this info, but you did not see it.

    • Upvote 1
  4. Did you actually get this fully working? I'd love to play with it. Haven't really tweaked my water much at all past throwing shadmar's newer water + caustics shader on it (which looks really cool, especially in the dark).

    yes it works, but I'm just a beginner experimenting things so it's still 99% Shadmar's work, I just tweaked it while learning shaders.

     

    I would still prefer LE4 to be natively able to animate the water by providing a listbox under the scene root to add all animated normal maps and handle them itself.

     

    The biggest issue is that the water has no physics, it's just a visual, nothing will float and move with the waves.

     

    Here is the file : Shadmar_Water_with_examplemap.zip

    ask me if you need instructions

  5. I dont know where you found this, but it's not for LE4, it was an interim water for LE3 when there were no other water solutions.

    So it's not updated to work with LE4.

    I know it's from LE3 (the link of the thread where I found it is provided in my first post). I did not find another water shader for LE4 and could not find how to animate current default water in LE4. So I tryed to use this one.

  6. Well && isn't a bit operation

    What are the commands for bitwise operations blink.png ? I'm a complete beginner, maybe it is worth mentionning these commands in a tutorial. If it is allready in a video tutorial, please point me to it because I missed it and need to rewatch.

  7. Ok, my bad. The material flag has to contain a 2 to be selected. Don't subtract 10 though. You should be using bit operations or else you can go negative and cause a bunch of flags to be checked by accident.

    I also wondered about this, but in the vertex stader he is adding 10 that's why I substract 10 to cancel this

    //If an object is selected, 10 is subtracted from the alpha color.
    //This is a bit of a hack that packs a per-object boolean into the alpha value.
    if (ex_color.a<-5.0)
    {
    ex_color.a += 10.0;
    ex_selectionstate = 1.0;
    }
    ex_color *= vec4(1.0-vertex_color.r,1.0-vertex_color.g,1.0-vertex_color.b,vertex_color.a) * materialcolordiffuse;
    }
    

    I find it very difficult to understand what happens to "alpha chanel-10" once multiplied by the vertex_color and materialdiffuseI

     

    But 10 (00001010) contains the 2 (00000010) bit.

     

    I believe in binary addition and substract work like a bitwise boolean operation.

    You probably allready know this, but if someone else is reading he won't understand what we are talking about, so I'll explain binary additions and substractions a little.

     

    if you take 255 it is 11111111 in binary

    if you take 10 it is 00001010 in binary

    if youn take 2 it is 00000010 in binary

     

    if you do 255 - 10 in binary you get 11111111 - 00001010 = 11110101 = 245

    if you do 255 - 2 in binary you get 11111111 - 00000010 = 11111101 = 253

     

    you can try it here http://www.calculator.net/binary-calculator.html?number1=11111111&c2op=-&number2=00000010&calctype=op&x=84&y=16

     

    I tryed it, and the fix also works with -2 instead of -10, so you are probably right.

     

    But when I tryed a bitwise operation and with "&& 253" or "& 253" shader failed to compile.

     

    Cheers

     

    PS: back to the shader tutorials #3 is waiting for me after a good night of sleep smile.png

    (by the way Is there a wiki about leadwerks shaders somewhere ?)

  8. Hi,

     

    I learned some tricks from your tutorial 2, like how to transform a Vec4 into a Vec3.xyz+vec3.a to remove/tweak the alpha channel separately and set it back.

     

    I came up with this modification where I re-substract 10 to the alpha chanel to remove Leadwerks "red selection boolean"

    #if BFN_ENABLED==1
    //Best-fit normals
    fragData1 = vec4(texture(texture15,normalize(vec3(normal.x,-normal.y,normal.z))).xyz,texture(texture15,normalize(vec3(normal.x,-normal.y,normal.z))).a-10);
    #else
    //Low-res normals
    fragData1 = vec4(normalize(normal)*0.5+0.5,fragData0.a-10);
    #endif
    

    It works but I see no difference compared to the version where fragData1 is completely commented out. An alternative is to remove the apha chanel completely and set it to 0 in the vec4 with the same result.

     

    I believe something is still wrong because I do not see the water go up & down at the shoreline.

  9. After experimenting, it turned out I had to comment those lines to get it working

    #if BFN_ENABLED==1
    //Best-fit normals
    //fragData1 = texture(texture15,normalize(vec3(normal.x,-normal.y,normal.z)));
    #else
    //Low-res normals
    //fragData1 = vec4(normalize(normal)*0.5+0.5,fragData0.a);
    #endif
    

    I know nothing about shaders, what is fragData1 supposed to do ?

    post-44-0-42831700-1468696139.jpg

    • Upvote 1
  10. Without looking at the GLSL code, it's probably not setting the material flag correctly. Look at the examples for model shaders. Without this flag explicitly set, the lighting shader will by default assume that it's "selected." This is actually how objects are colored when you select them in the editor.

    Thank you very much for the hint, this info definitely will be a great help. I had no idea what was going on. Thanks !

  11. New puzzle for the community with an artistic result smile.png

     

    in an atempt to animate water (because current LE4 waterplane cannot be animated right ?) I downloaded an old LE3 Shadmar exemple "Water_with_examplemap" from this old thread http://www.leadwerks.com/werkspace/topic/10794-needing-help/#entry79138

     

    It took me 2 days to figure out I had to use "drag & drop" to drag a camera to the Script.CameraOrPlayer=""--entity field and now it works but I my water is red.

     

    Can someone explain me why the water is red instead of blue ?

     

    Thank you

    post-44-0-08996400-1468558051_thumb.jpg

     

    PS: had to put a camera2 in the scene and modify this line

    self.camera=self.CameraOrPlayer.script.camera or self.CameraOrPlayer
    

    with this

    self.camera=self.CameraOrPlayer
    

    Otherwise it will crash if there is no FPS player attached to the CameraOrPlayer field

  12. How does real nature do waves on an island?

    In real nature waves are produced by the wind (depends on wind force, duration, distance) and near the island the seabed irregularities have an influence. Without wind, no waves.

    The problem is we don't have the processing power to fully simulate this in a game. My idea is exactly to manually simulate the wind effect and start waves in a given direction.

     

    Have all waves maybe converge towards the players position?

    this wont work with spectator camera or airplanes views.

    We could set the island center point, but this would not work is the island shape is a crescent or another fancy shape.

     

    PS: anyway since my solution is not a math puzzle, chances are very low Josh will be interrested by the idea biggrin.png

  13. You would just need to program your waves to be in parallel with the shore at any given instance.

    This brings us back to the initial problem, an island is round... how to make them parralel when an island is round ?

     

    Also I speak from the waves in the back in the picture, not the foam on the beach.

    Anyway Josh & Sharmar will do a better job than me, that's why I prefer using the suggestion box. wink.png

  14. By waves I mean Sea Waves with foam that progress to the shore, not just water wobling.

    Like in this image

    post-44-0-23540900-1466613197.jpg

     

    Also I prefer staying at the practical/theory level because Josh knows better how to do it technically.

  15. When i see Shadmar's water screenshot I remember old LE 2.x days when Josh tryed to make seawater and waves. There was a cool demo with a beach and a floating wood branch.

     

    By the time I had found the result was nice but not good enought for some so it was dropped in favor of an animated texture.

     

    The main issue was the waves that would be parallel to the beach on one side of the island, but perpendicular on the other sides. Of course perpendicular waves look unnatural, but the animation had no way to know the islands location.

     

    My idea to solve this would be to add a new feature to the editor. A special asset called "Wave generator"

     

    It would be a line (or a spline to make the maths more funny and not boring ^^) we could place in the editor, with, in the middle, an arrow for direction indicator.

     

    we cloud set the line/spline size, orientation, distance to beach, wave height, wave "decay" rate, spawn interval.

     

    it's not trivial because you'll have to manage automatic decrease of spawn interval when camera is far away, and don't compute waves out of camera view but still move the line, and of course do all the 3D stuff.

     

    i'm sure people would love positionning their waves in the editor :-)

    Cheers

     

    PS: I imagine the wave line would work a bit like moving a "vertex magnet", but of course I don't know what's technicaly the best way.

  16. You sneaky person.

     

    Material* material = Material::Create();
    material->Load("Materials\Developer\Bluegrid.mat");

    Should be:

    Material* material = Material::Load("Materials\Developer\Bluegrid.mat");

     

    What strange is that I do the same mistake with model = Model::create(); Model->Load(...) instead of model = Model::load

    and it works, do you have an idea why ? Sorry I'm still a beginner in C++.

  17. You sneaky person.

    Hi Josh smile.png

    You found the explanation and saved my day. As a reward I'll tell you why we got there wink.png

     

    I started from this example of setmaterial http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitysetmaterial-r183 and could have avoided the pitfall if I used the load exemple http://www.leadwerks.com/werkspace/page/api-reference/_/material/materialload-r266

     

    If you refer to the fact that my avatar remained invisible, it was because since LE3 armageddon and loss of possibility to use other alternative programming languages I was not using the engine anymore, but I still loved Leadwerks for the simplicity of it's command set and visuals. Since I was not using the engine and had nothing to exchange with the community I decided to go invisible.

     

    Why I'm back after so long ? Well, because after version 4 of Leadwerks I realized that people who were working on a SWIG wrapper finally failed. So I started writing my own called PWIG (Pascal Wrapper and Interface Generator). This forced me to install VC++ 2013 and learn the basics of C++ to tell my generator how to code in C++ for me.

     

    Stay relax, I perfectly understand you want to promote lua since it provides you more visibility of what people can achieve; it makes sense. Since I do not have enought knowledge of C++ and cannot provide good support I will not promote my work and this time it will stay a private work. So don't fear an alternate programming way will emerge, it won't happen this time.

     

    I really like some of the C++ features I discovered even if I still dislike his SMS style syntax. But one syntax flaw that made PWIG generate the code above is that there is no clear specification of the constructors in the class. In Pascal you must specify the keywords constructor/destructor but in C++ you can have as many as you want and specify nothing, so LOAD is a constructor that replaces CREATE but no way to know. And this leads to errors if you use a class and are not it's conceptor, errors that even you have difficulty to spot because of the ambiguity of the language.

     

    Cheers

    Thank you

    post-44-0-49100700-1465634936.jpg

     

    PS1 : I have awaken because VC++ can finally compile the code PWIG produces (It restored my willpower) but I have no idea how to solve the constructor enigma yet.

     

    PS2: Please don't tkink I prefer Pascal because of the syntax. It's not really the main reason. I prefer it because of the Component API build on top and integrated with the IDE. It simplifies my work and makes the code easyer to manage. C++ is great but I prefer to work with a small subset than being overwhelmed, I just like simplicity. I guess people who love Blitzmax think the same way.

    • Upvote 1
  18. Sorry guys, really wish it would be so easy ... but it's still diving me mad.

    Something must be wrong in my setup sad.png

    \\ are converted into / in log see screenshot + no error but still no good

    post-44-0-97497600-1465589124_thumb.jpg

     

    Crossing fingers someone will figure out

    Even tryed with full path as you can see... but in both case log says material and texture is loaded. Just not applyed.

     

    PS: I'll switch to beta buid now, maybe it'll help

     

    EDIT: same result with beta, I think I need some sleep now ...

  19. If it's not a bug what's wrong with my code please ?

     

    What can be causing this

     

    #include "App.h"
    using namespace Leadwerks;
    App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}
    App::~App() { delete world; delete window; }
    bool App::Start()
    {
    window = Window::Create();
    context = Context::Create(window);
    world = World::Create();
    camera = Camera::Create();
    camera->SetPosition(0, 0, -5);
    
    light = DirectionalLight::Create();
    light->SetRotation(45, 45, 45);
    light->SetPosition(0, 0, -3);
    //Create a material
    Material* material = Material::Create();
    material->Load("Materials\Developer\Bluegrid.mat");
    //material->SetColor(1, 0, 0);
    //Create a model and apply the material to it
    Model* model = Model::Box();
    model->SetPosition(0, -2, 0);
    model->SetScale(10, 1, 10);
    model->SetMaterial(material);
    return true;
    }
    bool App::Loop()
    {
    if (window->Closed() || window->KeyDown(Key::Escape)) return false;
    Time::Update();
    world->Update();
    world->Render();
    context->DrawRect(100, 10, 100, 60);
    context->Sync();
    return true;
    }
    

     

    This is what I get

    post-44-0-81567800-1465558591.jpg

×
×
  • Create New...