Coder Social home page Coder Social logo

Reload cuscene error about yocto-gl HOT 4 CLOSED

TerminalTit avatar TerminalTit commented on June 2, 2024
Reload cuscene error

from yocto-gl.

Comments (4)

TerminalTit avatar TerminalTit commented on June 2, 2024

I would be very grateful for any help in solving this problem

from yocto-gl.

TerminalTit avatar TerminalTit commented on June 2, 2024

I think we need to create new functions like update_cutrace_cameras. For example update_cutrace_shapes, update_cutrace_instances.

I can rotate mesh or camera on CPU, but I can rotate only camera while on GPU
Here some code of animation 360:

auto funcRotation = [](float angle, float o_x, float o_y, float radius_x, float radius_y)
  {
        float rad_angle = angle/rad;
        float point_x = o_x + radius_x * std::cos(rad_angle);
        float point_y = o_y + radius_y * std::sin(rad_angle);
        return vec2f{point_x,point_y};
    };

for (int i=0; i<steps; ++i)
 {
        vec2f coord_xz = funcRotation(angle,0,0,radius_x,radius_y);
        angle += angle_step;

        //*** CAMERA ROTATION***
        auto &cur_camera = _scene.cameras[0];
        cur_camera.frame = lookat_frame({coord_xz.x, 0, coord_xz.y},{0,0,0},{0,1,0});
        //*** MESH ROTATION work only with CPU***
        //auto &cur_instanse = _scene.instances[0];
        //cur_instanse.frame = lookat_frame({0, 0, 0},{coord_xz.x,0,coord_xz.y},{0,1,0});

#ifdef YOCTO_CUDA
        update_cutrace_cameras(_context,_cuscene,_scene,_params);
        reset_cutrace_state(_context,_state,_scene,_params);
        trace_start(_context, _state, _cuscene, _bvh, _lights, _scene, _params);
#else
        _state = make_trace_state(_scene, _params);
#endif

        for (auto sample : range(0, _params.samples, _params.batch))
        {
            auto sample_timer = simple_timer{};
#ifdef YOCTO_CUDA
            trace_samples(_context, _state, _cuscene, _bvh, _lights, _scene, _params);
#else
            trace_samples(_state, _scene, _bvh, _lights, _params);
#endif
            print_info("render sample {}/{}: {}", _state.samples, _params.samples, elapsed_formatted(sample_timer));
        }
        print_info("IMAGE render image: {}/{}", i+1, _rp.steps);
}

from yocto-gl.

TerminalTit avatar TerminalTit commented on June 2, 2024

So we can add or change shapes on CPU, but we can't add or change shapes on GPU. if i'm wrong, please guide me

from yocto-gl.

xelatihy avatar xelatihy commented on June 2, 2024

Yes you are right. Shapes on GPU are fixed. On CPU you can only make small changes.

In general, the system is written under the assumption that the Bvh/Light gets fully rebuild on scene changes though. This is unlikely to change in the future since we optimize for large scene rendering and not interactive applications.

from yocto-gl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.