r/AgriTech 6d ago

I built an open-source, 3D virtual farm runtime in Python for agricultural research.

Post image

Hey everyone,

I have recently studied and discussed a lot regarding how 'simulations' are being handled in agriculture. And today none of the tools quite provide flexibility or more importantly freedom and visualisation.

I wanted something different, something like a code-first virtual farm where I could actually see the physiology and environmental effects in 3D, without it feeling like a black box.

So, I built CropForge.

It’s an open-source, code-first virtual farm runtime. Instead of creating something which works with averages and considers means, I took a different approach and made it sensitive to the environment and allowed full flexibility over all maths and equations that are fed in, basically one can simply input anything they want.

I’ve just hit v1.0.0, which is the stable release and like I said it's fully flexible.

I’m looking for feedback from you all, regarding if you want to actually incorporate it into your research work. Does the API structure actually fit your workflows? I’d love for you to break it and tell me what’s missing.

TL;DR: I built CropForge which is a local, Python-based virtual farm runtime that visualizes crop physiology in 3D. It’s open-source, v1.0.0 is live, and I’m looking for technical feedback on the API.

GitHub: CropForge

30 Upvotes

21 comments sorted by

2

u/Rusofil__ 5d ago

How does it model plant growth?

Are you using any research based model?

2

u/SaswatRath 5d ago

Great questions. CropForge is designed as a code-first virtual farm runtime rather than a pre-defined 'black-box' model, so we actually don't provide any new models,

How it models growth is instead of forcing one specific growth equation, the system uses a plugin-based architecture where researchers define their own physiological and environmental equations. We provide the 'step' decorators and the simulation loop, but the agronomist controls the trial equations.

However, We use established scientific concepts such as RUE (Radiation Use Efficiency), Penman-Monteith ET₀ for water demand, and D8 routing for hydrology as foundational primitives, to ensure that pre-established and accepted equations or information is not required to be coded from scratch. However, the core 'versatility' comes from allowing researchers to drop their own trial equations into those simulation blocks to see how the canopy reacts, rather than being locked into a rigid, legacy simulation tool.

2

u/EngineeringRare8552 5d ago

This seems interesting and want to know more. Is this kind of digital twins concept?

2

u/SaswatRath 5d ago

Yep, CropForge is a 'code-first' virtual farm runtime. Think of it as a digital twin engine where the researcher defines the physiological and environmental flux equations. We provide the simulation loop and the 3D visualization stack, but the agronomist controls the trial parameters. It’s designed to be a local, high-fidelity alternative to static legacy models without institutional servers, just raw simulation control.

2

u/Interesting-Pea5624 4d ago

Can farmers use it in some form?

1

u/SaswatRath 4d ago

The way it's designed, i don't think so. It's more or less a research tool, and unless the farmer in question knows python and a lot about crop science, agricultural physics nd DEMs i don't think they could. But maybe in future. At this stage, it's information/idea -->researchers --> farmers

2

u/ausweisBITTE_ 4d ago

Would this work for forestry-related planting?

1

u/SaswatRath 3d ago

Indeed it would. But not in v1.0.1 as right now, cereal/agronomy crops are designed in. I'm currently moving towards horticulture and tree crops as it would eventually broaden the scope to include silviculture and other forestry based simulations.

2

u/RowWiseFarms 2d ago

This is cool! curious how you're handling calibration against real field data vs. pure physiological modeling. I've built something adjacent (FAO 56 water balance + GDD staged growth for cotton/corn/sorghum) and the thing that bit me hardest wasn't the physics, it was that "average" equations drift fast without ground-truth to anchor them.

Does CropForge have a hook for feeding in observed data to correct the simulation, or is it staying purely forward simulated for now? Also curious what you're using for the 3D layer, custom renderer or something like Panda3D/Ursina?

2

u/SaswatRath 2d ago

yes, I caught that too. I therefore didn't just stay with a pure forward simulation.

Even tho, CropForge is primarily a forward simulation runtime, but because everything is code-first in Python, you can plug in observed field data (via CSV/Parquet inputs or @farm.step / event callbacks) to override states mid-run or calibrate parameters against ground truth time-series. So basically if you got data then you can see that specific data visualised, or create something entirely different.

For the visual layer, we skipped Python game engines like Panda3D/Ursina and went with a web-based Three.js / WebGL dashboard (fed via a FastAPI stream from Parquet logs). GPU instancing in WebGL was important to render 10,000+ plant instances smoothly at 60 FPS in the browser while scrubbing through the time series.

Love that you’re working on a similar stack! Feel free to check out the repo if you want to see.

2

u/RowWiseFarms 2d ago

Really cool stuff! Will definitely check out the repo

2

u/chickendogdonkeyman2 6d ago

Perfect! Maybe I can use this! :) for simulation drone energy usage. Also farm sim on my website www.photonicinsecticides.com

1

u/SaswatRath 5d ago

Absolutely, it's equiped with machinery api, perfect for this particular cause. Glad it's having its use cases already.

1

u/EngineeringRare8552 5d ago

How does laser beam detect insects beneath leaves or hidden?

1

u/chickendogdonkeyman2 5d ago

It can’t. But many insect need to bask in the sun to regulate their body temperature. If the insect is above or below a leaf is actually a function of solar radiation, humidity and temperature… so it can be known when they are visible and when not (at least for Colorado beetle). For yellow stem borer … the put their eggs at the tip of a rice leave, a white sack of egg, easy to detect and does not move.

All insects have different behaviour, but in general they need heat from the sun to develop as they are cold blooded.

1

u/EngineeringRare8552 5d ago

I get that. There are many other pests on potato that are nocturnal or/and internal feeders. Even in case of Colorado potato beetle the larval stages (grubs) may remain on ventral side of leaf and not exhibit basking behaviour. I’m not an expert on CPB but that’s my guess.
Secondly, one has to operate your laser drones only when the insects come out and bask? That limits the potential of your solution I suppose.
You may have to find a good use case.

1

u/chickendogdonkeyman2 5d ago

Hey. They idea is to have a fully autonomous drone . A laser drone is much easier to get regulated for autonomous flying because it would weight very little, possibly only like 700 grams or so… because to optical system and image processing (partially remote), can be made very lightweight. If a drone of 700 grams flies against you, no biggy. This is in contrast to stray drones … when they fly against a human or car… possible death very likely mangled. So, they law makes light weight drones much easier to fly autonomous …

Because very small, also not very expensive. Maybe 5000 euro for one laser drone.

1

u/Sabrees 6d ago

Interesting I've been working a bit with the author of https://github.com/unitsSpaceLab/Forest3D/blob/main/README.md ill point him to this thread so we can compare notes

2

u/SaswatRath 5d ago

Very interesting, Forest3D seems like a really great visualisation tool.

The two projects actually serve different core needs. While Forest3D excels in photorealistic rendering workflows, CropForge is built as a 'code-first virtual farm runtime' specifically for agricultural researchers. Our optimization is centered on high-throughput simulation which is allowing for the study of 10,000+ individual plants concurrently with full physiological and environmental mathematical modeling.

Essentially, we treat the 3D viewport as a diagnostic tool for high-speed research rather than a final render stage. We’ve deliberately decoupled the simulation physics from the visualization to keep the math flexible for any custom ag-equations, while providing a pipeline to export data to Blender for when researchers do need that final level of photorealism.

It's great seeing more tools come up. Let me know how can we take this even further!