How camera works?

render.set_viewport(0,0,800,600) means that if you have a window that is for instance 1400x1200 pixels then the game will render only in the area from 0x0 to 800x600. The rest will not be used when rendering.

What is actually being rendered in those 800x600 pixels depends on the view and projection that you use. You need to position your camera accordingly and you need to make sure to use a suitable projection.

2 Likes

The capture that I upload show it. The same camera position, I resize the window, and it show more game area , that is not the objective.

Hereā€™s a complete example:

Iā€™m basing this off the default.render_script with the required modifications to be able to crop using black bars when using fixed_fit_projection.

Enable crop like this:

msg.post("@render:", "use_fixed_fit_projection", { near = -1, far = 1, crop = true })

And this is the render script:

2 Likes

I think now is working as expected, but have no zoom.

Well, you mentioned fixed fit which adjusts the zoom automatically.

and cannot use zoom some way in this mode?

As I said, the zoom is automatically calculated here:

Modify the script and provide your own zoom.

1 Like

thanks

Iā€™m going through old threads in search of an answer for a similar problem, and Iā€™m also feeling frustrated. Rendercam and Orthographic Camera are the recommended solutions, and Iā€™m sure they work for what theyā€™re intended for, but I couldnā€™t get them working for my situation.

Because Iā€™ve hit a brick wall with this, Iā€™ve decided to hire someone more experienced to help. It would have been nice to solve the problem myself, but the tutorials and information are too complicated for me.

The videos and posts here on the forum often suggest how simple and easy it is to understand and implement, but I wish that was the case. For someone who isnā€™t a computer science major or proficient at advanced math, the topics (e.g., formulas, inverting matrices, rendering, etc.) are very difficult.

3 Likes

Yes, this would be very helpful. Itā€™s the one thing preventing me from having the functionality I want with my game.

1 Like